pushserver
pushserver copied to clipboard
A server for sending push notifications to mobile apps
push server
Hapi server app for creating and distributing push notifications
Table of Contents
- Getting Started
- Running the server
- App Configuration
- Securing the app
- Run tests
- API
- Notifications
- Subscriptions
- Errors
- Angular App
Getting Started
npm install
bower install
gulp build
gulp syncDb
Running the server
Start the hapi server and set up watches on templates, js and css
gulp watch
App Configuration
App config is controlled via the node-config module.
To set push credentials, create a local.json file under the config dir and override the CREDENTIALS setting.
Alternately, you can use:
Securing the app
By default, the app exposes all API endpoints and the web UI. This would allow a 3rd party to send a correctly crafted notification object to the server and have it go to all subscribers.
You should ensure that wherever the app is running it either:
- has an authentication layer
- is running behind another server, nginx / apache etc., that restricts access to the relevant endpoints
Run tests
gulp test
API
Notifications
POST/api/1/notifications - adds a new notification to the database and publishes it to all attached channelsGET/api/1/notification/{notificationId} - fetches the notification matching notificationIdPOST/api/1/notifications/search - fetches all notifications matching the supplied search object
See the schema object for details of the object structure these endpoints accept
Subscriptions
POST/api/1/subscriptions - adds a new subscription and subscribes that user to notifications from their preferred channel(s)DELETE/api/1/subscriptions/{deviceId} - deletes a subscription
See the schema object for details of the object structure these endpoints accept
Errors
POST/api/1/errors - Logs a client-side error to the server logs
See the schema object for details of the object structure these endpoints accept
Angular app
See the www/README.md for details