https://github.com/zetapush/zetapush
ZetaPush BaaS
https://github.com/zetapush/zetapush
baas javascript realtime typescript websocket zetapush
Last synced: 8 months ago
JSON representation
ZetaPush BaaS
- Host: GitHub
- URL: https://github.com/zetapush/zetapush
- Owner: zetapush
- License: mit
- Created: 2018-02-19T16:23:09.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-01-15T11:03:44.000Z (over 6 years ago)
- Last Synced: 2025-02-04T17:50:25.846Z (8 months ago)
- Topics: baas, javascript, realtime, typescript, websocket, zetapush
- Language: TypeScript
- Homepage: https://doc.zetapush.com/
- Size: 4.97 MB
- Stars: 13
- Watchers: 5
- Forks: 2
- Open Issues: 12
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
The next generation backend-as-a-service[![NPM version][npm-version-image]][npm-url]
[![Build Status][build-status-image]][build-status-url]# ZetaPush JavaScript SDK
> This project is a monorep containing all source of @zetapush/* ecosytem
## Installation
npm 6+
```console
npm init @zetapush myproject
cd myproject
```npm 5.x
```console
npx @zetapush/create myproject
cd myproject
```## Deployment
Push your code on ZetaPush platform
```console
npm run deploy
```## Development
Run your code on your local platform
```console
npm run start
```## Default project structure
```console
.
└──
├── front
│ ├── index.html
│ └── index.js
├── worker
│ └── index.ts (api implementation)
└── package.json
```## How it works?
> Server side
Your server api in a plain old class defining your interface.
Example:
```js
export default class Api {
hello() {
return `Hello World from JavaScript ${Date.now()}`;
}
}
```This code expose an API called **hello** which returns a string "Hello World from JavaScript" concatened with server timestamp.
You can use injected platform services with to following.
> Dependency injection use [injection-js](https://github.com/mgechev/injection-js)
```js
import { Injectable } from '@zetapush/core';
import { Stack } from '@zetapush/platform-legacy';@Injectable()
export default class Api {
constructor(private stack: Stack) {}
push(item) {
return this.stack.push({ stack: 'list', data: item });
}
}
```To consume an API in your front-end application you have to create a **mapped** method.
> Client side
#### Register your API mapping class
```js
const api = client.createProxyTaskService();
```#### Invoke your remote API method
```js
const message = await api.hello();
```[npm-version-image]: http://img.shields.io/npm/v/@zetapush/client.svg?style=flat-square
[npm-url]: https://npmjs.org/package/@zetapush/client[build-status-image]: http://img.shields.io/travis/zetapush/zetapush.svg?style=flat-square
[build-status-url]: http://travis-ci.org/zetapush/zetapush