Giter Site home page Giter Site logo

mini-wp's Introduction

mini-wp

routes

POST baseurl /auth/login to get a token, to authorize some further access of API

POST baseurl /auth/register to register a credential, to access the api later

POST baseurl /auth/google-login to generate api token, using google oAuth2 token

GET baseurl /article-home to get articles shown at home page

GET baseurl /article/:id to get an article

POST baseurl /article to create an article, require api token

PATCH baseurl /article/:id to update an article, require api token

DELETE baseurl /article/:id to delete an article, require api token

Authentication

Registration


Method: POST

URL: /auth/register

Request Body:

{
    name: String,
    email: String,
    password: String
}

Response Success

Status: 201

Body:

{
    _id: String //mongoose schema id,
    name: String,
    email: String
}

Response Failure

Status: 500

Body:

{
  message: "Internal Server Error";
}

Getting Access Token

Method: POST

URL: /auth/login

Request Body:

{
    email: String,
    password: String
}

Response Success

Status: 201

Body:

{
    user: {
        _id: String,
        name: String,
        email: String   
    },
    token: String
}

Response Failure

Status: 500

Body:

{
  message: "Internal Server Error";
}

Getting Access Token using google oAuth2 Token

Create Article

method POST url /article header

{
  token: mini - wp - api_token;
}

response success status 201 body

{ author: String, title:String, content:String, created_at:Date, featured_image: String, tags:[String] }

response fails status 500 body

{ msg:'internal server error' }

Delete Article

method POST url /article/:id header

{
  token: mini - wp - api_token;
}

response success status 204 body

{ author: String, title:String, content:String, created_at:Date, featured_image: String, tags:[String] }

response fails status 500 body

{ msg:'internal server error' }

Update Article

method POST url /article header

{
  token: mini - wp - api_token;
}

response success status 201 body

{ author: String, title:String, content:String, created_at:Date, featured_image: String, tags:[String] }

response fails status 500 body

{ msg:'internal server error' }

Get an Article

method POST url /article header

{
  token: mini - wp - api_token;
}

response success status 201 body

{ author: String, title:String, content:String, created_at:Date, featured_image: String, tags:[String] }

response fails status 500 body

{ msg:'internal server error' }

Get All Articles

method POST url /article header

{
  token: mini - wp - api_token;
}

response success status 201 body

{ author: String, title:String, content:String, created_at:Date, featured_image: String, tags:[String] }

response fails status 500 body

{ msg:'internal server error' }

mini-wp's People

Contributors

leshau90 avatar dmtrxw avatar

Watchers

James Cloos avatar  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.