Implementing sending/receiving registration using post requests
In a different approach from the one used in Socket.io
, let's explore the other way around using post requests. This means that we'll use a REST API that will handle all that for us. At the same time, it will handle saving the registration_token
value in a secure place as well. So let's see how we can configure that.
How to do it...
- First, let's start writing our REST API. We will do that by creating an express post endpoint. This endpoint will be porting our data to the server, but before that, let's install some dependencies using the following line:
~> npm install express body-parser --save
Let's discuss what we just did:
- We're using npm to download ExpressJS locally to our development directory.
- Also, we're downloading body-parser. This is an ExpressJS middleware that will host all post requests data underneath the
body
subobject. This module is quite a common package in the NodeJS community, and you will find it pretty...