Giter Site home page Giter Site logo

newsapi's Introduction

News API

MIT License

A NewsAPI With Advanced Authentication And Autorization Using JWT(Json Web Tokens). Provides Fully Functionalities For Creating Own News Websites Fastly.

Installation

Install dependencies with npm

  npm install --save

Runserver

Start server with npm

  npm start

API Reference

Create User

  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

Login User

  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 Posts

  GET /feed/posts

To retrive all posts

Get Single Post

  GET /feed/posts/${postId}

Thsi end-point will send a single post back

Create Post

  POST /feed/post/create
Parameter Type Description
title string Required.
description string Required.
image file Required.
token string Required. Autorization Header Required
Use Autorization Header to send token(Only token without bearer).

You will get back a created post

Update Post

  PUT /feed/post/${postId}
Parameter Type Description
title string Required.
description string Required.
image file Optional.
token string Required. Autorization Header Required
Use Autorization Header to send token(Only token without bearer).

Delete Post

  DELETE /feed/post/${postId}
Parameter Type Description
token string Required. Autorization Header Required
Use Autorization Header to send token(Only token without bearer).

Like/Dislike Post

  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.

Comment on 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.

newsapi's People

Contributors

sudo0x18 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.