This is a simple REST API server implementation built on top of Node.js and Express.js with Mongoose.js for MongoDB integration. Authentication is handled using JWT integration. Testing is handled using mocha and chai
git clone https://github.com/Nipan83/blog-API.git
cd blog-API
You need to have Node.js and npm installed.
# Install all dependencies
npm install
# Start the server
npm start
http://localhost:3000/
https://nipan-blogapi.herokuapp.com/
Check the APIs using Postman
http://localhost:3000/register
or
https://nipan-blogapi.herokuapp.com/register
This route allows a user to register herself on the platform with basic information
▪ username, email, password, firstname, lastname, blogURL
Email must be unique for new registration.
All you need to do is pass the information in the request body in key-value pair
http://localhost:3000/login
or
https://nipan-blogapi.herokuapp.com/login
This route allows a user to log in herself on the platform with basic information
▪ email and password
All you need to do is pass the information in the request body in key-value pair
A JWT TOKEN will be returned which will be used for further using the API.
The token should be placed in header key as x-access-token and value will be the token.
http://localhost:3000/blogpost
or
https://nipan-blogapi.herokuapp.com/blogpost
This route allows a user to create a blog post with following parameters
▪ Title, content
Authentication is handled here using JWT
http://localhost:3000/follow/{username}
or
https://nipan-blogapi.herokuapp.com/follow/{username}
This route allows you to follow new users
http://localhost:3000/feed
or
https://nipan-blogapi.herokuapp.com/feed
This route returns all blog posts of users you follow
NOTE: For viewing own blog post user have to follow himself.
http://localhost:3000/getuser
or
https://nipan-blogapi.herokuapp.com/getuser
This route returns all the users registered.
This route is for monitoring purpose.
Token will also be needed here.
# TESTING of APIs
npm test
# NOTE: Since email field is unique for registering a user. So register test case may fail after running npm test two times.
# To prevent the error, open test/test.js and change the email value to a new emailId.
Created and Maintained by @Nipan83 - nipandas83@gmail.com





