Giter VIP home page Giter VIP logo

mini-wp-1's Introduction

mini-wp

api-Documentation :

API-BASE-URL: http://35.184.99.60:3000

List of available endpoints:

Articles

  • POST /articles
  • GET /articles
  • GET /articles/:title
  • DELETE /articles/:id
  • PUT /articles/:id

Authors

  • POST /authors
  • POST /authors/login
  • POST /authors/login/oauth/:googleToken
  • GET /authors

Error response format:

{
  "message": "..."
}

POST /articles

  • Request Header(s):
    • Content-Type: application/x-www-form-urlencoded
    • Authorization: token <jwt token>
  • Request Body:
    • title: { type: String, required: true, unique: true, minlength: 10, maxlength: 100 }
    • tags: [{ type: String, required: true, minlength: 3, maxlength: 15 }],
    • content: { type: String/ html, required: true, minlength: 100, maxlength: 50000 }
    • featured_image: { file }
  • Response:
    • status: 201
    • details:
      {
          "message": "...",
          "details": {
              "tags": [
                  "...",
                  "..."
              ],
              "_id": "...",
              "title": "...",
              "author": "...",
              "content": "...",
              "featured_image": "...",
              "created_at": "...",
              "__v": 0
          }
      }

GET /articles

  • Request Header(s):
    • Authorization: token <jwt token>
  • Response:
    • status: 200
    • details:
          [{
              "tags": [
                  "...",
                  "..."
              ],
              "_id": "...",
              "title": "...",
              "author": {
                  "_id": "...",
                  "name": "..."
              },
              "content": "...",
              "featured_image": "...",
              "created_at": "...",
              "__v": 0
          }]

GET /articles/:title

  • Request Header(s):
    • Authorization: token <jwt token>
  • Response:
    • status: 200
    • details:
          [{
              "tags": [
                  "...",
                  "..."
              ],
              "_id": "...",
              "title": "...",
              "author": {
                  "_id": "...",
                  "name": "..."
              },
              "content": "...",
              "featured_image": "...",
              "created_at": "...",
              "__v": 0
          }]

DELETE /articles/:id

  • Request Header(s):
    • Authorization: token <jwt token>
  • Response:
    • status: 200
    • details:
      {
          "message": "...",
          "details": {
              "tags": [
                  "...",
                  "..."
              ],
              "_id": "...",
              "title": "...n",
              "author": "...",
              "content": "...",
              "featured_image": "...",
              "created_at": "...",
              "__v": 0
          }
      }

PUT /articles/:id

  • Request Header(s):
    • Content-Type: application/x-www-form-urlencoded
    • Authorization: token <jwt token>
  • Request Body:
    • title: { type: String, required: true, unique: true, minlength: 10, maxlength: 100 }
    • tags: [{ type: String, required: true, minlength: 3, maxlength: 15 }],
    • content: { type: String/ html, required: true, minlength: 100, maxlength: 50000 }
    • featured_image: { file }
  • Response:
    • status: 201
    • details:
      {
          "message": "...",
          "details": {
              "n": 1,
              "nModified": 1,
              "opTime": {
                  "ts": "...",
                  "t": 5
              },
              "electionId": "...",
              "ok": 1,
              "$clusterTime": {
                  "clusterTime": "...",
                  "signature": {
                      "hash": "...",
                      "keyId": "..."
                  }
              },
              "operationTime": "..."
          }
      }

POST /authors

  • Request Header(s):
    • Content-Type: application/x-www-form-urlencoded or application/json
  • Request Body:
    • name: { type: String, required: true, minlength: 5, maxlength: 30 }
    • email: [{ type: String, required: true, unique: true }],
    • password: { type: String, required: true, minlength: 8, }
  • Response:
    • status: 201
    • details:
      {
          "message": "...",
          "token": "..."
      }

POST /authors/login

  • Request Header(s):
    • Content-Type: application/x-www-form-urlencoded or application/json
  • Request Body:
    • email: [{ type: String, required: true, unique: true }],
    • password: { type: String, required: true, minlength: 8, }
  • Response:
    • status: 200
    • details:
      {
          "message": "...",
          "token": "..."
      }

POST /authors/login/oauth/:googleToken

  • Request Header(s):
    • Content-Type: application/x-www-form-urlencoded or application/json
  • Request Body:
    • email: [{ type: String, required: true, unique: true }],
    • password: { type: String, required: true, minlength: 8, }
  • Response:
    • status: 200 or 201
    • details:
      {
          "message": "...",
          "token": "..."
      }

GET /authors

  • Request Header(s):
    • Authorization: token <jwt token>
  • Response:
    • status: 200
    • details:
      {
          "message": "...",
          "details": {
              "_id": "...",
              "name": "...",
              "email": "...",
              "password": "...",
              "__v": 0
          }
      }

mini-wp-1's People

Contributors

fragilities avatar michaelwp avatar rubhiauliatirta 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.