A NewsAPI With Advanced Authentication And Autorization Using JWT(Json Web Tokens). Provides Fully Functionalities For Creating Own News Websites Fastly.
Install dependencies with npm
npm install --save
Start server with npm
npm start
POST /auth/create
Parameter | Type | Description |
---|---|---|
firstname |
string |
Required Min 3 Chars |
lastname |
string |
Required Min 3 Chars |
email |
string |
Required |
password |
string |
Required Min 8 Chars |
cpassword |
string |
Required Min 8 Chars |
This end-point will return a created user object back
POST /auth/login
Parameter | Type | Description |
---|---|---|
email |
string |
Required. Email of user |
password |
string |
Required. Password of user |
By login in with correct credentials you will get a authentication token and userId back, which will be valid for one hour.
GET /feed/posts
To retrive all posts
GET /feed/posts/${postId}
Thsi end-point will send a single post back
POST /feed/post/create
Parameter | Type | Description |
---|---|---|
title |
string |
Required. |
description |
string |
Required. |
image |
file |
Required. |
token |
string |
Required. Autorization Header Required |
You will get back a created post
PUT /feed/post/${postId}
Parameter | Type | Description |
---|---|---|
title |
string |
Required. |
description |
string |
Required. |
image |
file |
Optional. |
token |
string |
Required. Autorization Header Required |
DELETE /feed/post/${postId}
Parameter | Type | Description |
---|---|---|
token |
string |
Required. Autorization Header Required |
PATCH /feed/post/${postId}
Parameter | Type | Description |
---|---|---|
token |
string |
Required. Autorization Header Required |
Using this end-point you can like or dislike to post. If you have liked then it will deslike it , and if you not done anything it will add like to post.
PATCH /feed/post/comment/${postId}
Parameter | Type | Description |
---|---|---|
comment |
string |
Required. |
token |
string |
Required. Autorization Header Required |
This end-point gives you an ability to comment on post, we return a updated post with comments.