The API for the Mobnode application.
Simply install the project dependencies with yarn or npm.
$ yarn install
... or
$ npm installTo develop for the Mobnode API, there are some configurations that have to be made in the .env file.
To get started quickly, copy the .env.example file committed to the repository.
$ cp .env.example .envThe API server strictly enforces SSL usage; therefore, we must supply a path to a valid certificate, key, and certificate authority. An example for how we develop interally is as follows.
SSL_KEY_PATH="/path/to/private/key.pem"
SSL_CERT_PATH="/path/to/certs/cert.pem"
SSL_CA_PATH="/path/to/ca-chain.cert.pem"
In addition to SSL configuration, it is also important to provide the host the API is running on, the main CouchDB user, and the secret that the CouchDB uses to successfully implement proxy authentication.
After all the configuration is done, simply run the server using yarn or npm.
This is the documentation for each of the endpoints on the Mobnode API.
Note: All POST, PUT, and DELETE requests only accept a Content-Type of application/json. This is for simplicity and security.
/api/nodes - The endpoint for maintaining the nodes (remote Mobnodes) in a given network.
GET- Retrieves all the nodes in a networkPOST- Creates a new node given the proper JSON structure. The following fields are required.node_name- A simple name for the nodehost- The host name at which the remote Mobnode residesport- The port at which the application is accessibleusername- (Temporary) Used for remote authenticationpassword- (Temporary) Used for remote authentication
PUT- Batch updates nodes through CouchDB's bulk docs API. Instead of passing a JSON array with a key value of"docs", simply pass the array of nodes (following the specified JSON format in thePOSTrequest) with a key value of"nodes". Below is a visualization.
{
"nodes": [
{
node_name: "mynode",
...
}
]
}DELETE- Uses the bulk docs API references above to delete docs in bulk. Follow the same convention asPUT, except useDELETE.