/subscriptions-api

This is a sample subscriptions microservice written for #team-gold in HNGi7 by @clish to be used by saas apps to handle user subscriptions.

Primary LanguageJavaScript

subscriptions-api

This is a sample subscriptions microservice api for #team-gold in HNGi7 by @clish
##Do this before testing it
*Install mongodb in your machine, find a guide here (https://docs.mongodb.com/manual/installation/)
*Instal nodejs
*Install the app's dependencies

npm install
##To run the app

node run server.js

##endpoints
*POST /v1/user/register : will add user to the database with name,email,and password.
*POST /v1/user/login : will authenticate a user and respond with an access token which will be added to the headers "auth-token" : "token",this token must be used in order to access other routes.
*GET /v1/subscribers: will give all subscribers stored in database and their ids.
*GET /v1/subscribers/<subscriber_id>: will give a specific subscriber with subscriber_id.
*POST /v1/subscribers : create a new subscriber
*DELETE /v1/subscribers/<subscriber_id>: delete a subscriber
*PUT /v1/subscribers/<subscriber_id>: update a subscriber completely

user schema = { name : String, email : String, password : String }
subscriber schema = { first_name:String, last_name:String, email:String, plan:String }