Giter Site home page Giter Site logo

mini-wp's Introduction

Mini Wp

Getting Started

If you want to used this API & Client you need to run this in your terminal

//install dependencies
$ npm install

//install dev dependencies for dotenv
$ npm install -D dotenv

// running the server
$ npm run dev

Access the API via http://localhost:3000/

POST /users/register
url : '//localhost:3000/users/register',
body : {
    name : usertest,
    password : password,
    email : [email protected]
},
response : 
 "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjVlMjUyYWVlYTY4ZDAwNjg0NjQzNzVjZiIsIm5hbWUiOiJBbmRhcmEgTWlzdW8iLCJlbWFpbCI6ImFuZGFyYUBtYWlsLmNvbSIsImlhdCI6MTU3OTQ5NDEyNn0.baWoMUMo-HRejSn18eQW4iHEeySBixGIBYAiT7zYKzI"
POST /users/login
url : '//localhost:3000/users/register',
body : {
    email : usertest,
    password : password,
}
response: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiI1ZTFiY2Q1MWQ0N2I0NTBhNWQ1NmM2OGEiLCJ1c2VybmFtZSI6InVzZXJuYW1lMTAxIiwiaWF0IjoxNTc4ODgwNDg4fQ.I0E3TnxdECuYr2Ao-4pZ-R7LL_liFvvVVjtbQYge9SY"
GET /articles/
url : '//localhost:3000/articles/',
headers: {token}
response : [
    {
        "created": "2020-01-19T10:57:08.847Z",
        "_id": "5e243d14db77414439a5324f",
        "title": "Coba Upload Gambar 9:16",
        "content": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce finibus dignissim consectetur. Aliquam erat volutpat. Proin tincidunt justo erat, vel euismod odio ornare ut. Quisque eget egestas quam. Etiam non dui eleifend, suscipit massa in, vulputate urna. Maecenas eget tincidunt leo, quis auctor nulla. Nunc pellentesque mi ex, quis mollis odio aliquet vitae. Pellentesque pretium aliquam lacus eu tincidunt. Maecenas dictum mauris sed turpis dictum, eu imperdiet tellus hendrerit. Etiam a elit id lorem vestibulum pharetra vitae sit amet sapien. Cras eget justo maximus, iaculis ligula eget, molestie elit.",
        "thumbnail": "https://storage.googleapis.com/miniwp-upload/1579433235144-photo-1576562492346-af59df6a1504.jpeg",
        "author": {
            "_id": "5e241d0549a5046325be0521",
            "name": "Helga Hinaya"
        },
        "__v": 0
    }]
POST /articles/
url : '//localhost:3000/articles/',
headers: {token}
body : {
    title : 'Article Title',
    content : 'Description of content',
  	thumbnail: File
}


response:
    {
    "created": "2020-01-20T04:07:33.651Z",
    "_id": "5e252ce1a68d0068464375d0",
    "title": "Article Title",
    "content": "Description of content",
    "thumbnail": "https://storage.googleapis.com/miniwp-upload/1579494625126-header-graphic.png",
    "author": "5e241d0549a5046325be0521",
    "__v": 0
}
GET /articles/{id}
url : '//localhost:3000/articles/5e252ce1a68d0068464375d0',
headers: {token}
response : {
    "created": "2020-01-20T04:07:33.651Z",
    "_id": "5e252ce1a68d0068464375d0",
    "title": "Article Title",
    "content": "Description of content",
    "thumbnail": "https://storage.googleapis.com/miniwp-upload/1579494625126-header-graphic.png",
    "author": {
        "_id": "5e241d0549a5046325be0521",
        "name": "Helga Hinaya"
    },
    "__v": 0
}
PUT /articles/{id}
response : {
    "message": "Article Successfully Updated"
}

Error Handling


  • 400
    {
    	message:'Invalid Token'
    }
    
  • 403
    {
    	code: 403,
        status: 'Forbidden',
        message: 'You Don\'t have access to this Articles'
    }
    
  • 404
    {
    	code: 404,
    	status: 'Not Found',
    	message: 'Cannot find Articles'
    
    }
    
  • 500
    {
    	message : 'Internal Sever Error'
    }
    

mini-wp's People

Contributors

bayuoktari 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.