Giter Club home page Giter Club logo

mini-wp-1's Introduction

Documentation

DEPLOY: http://miniwp.orvinsavero.com/

Register

  • route:
    • POST /register
  • request:
  • response:
  • error:
    • Validation Error
- Email is unique, so it is not allowed to have same email in database.

- Password is hashed with bcryptjs.

Login

  • route:
    • POST /login
  • request:
  • response:
    • 201: { token: '...' }
  • error:
    • 404 not found
Token is generated from JWT package.

Google Signin

  • route:
    • POST /google
  • request:
  • response:
    • 201: { token: '...' }
  • error:
    • 500 internal server error
- If Google email is present in database, user receive token that is generated from JWT package.

- If Google email is not present in database, Google email will be registered to database and password is randomly generated, then user automatically login and receive token that is generated from JWT package.

Create Article

  • route:
    • POST /home
  • request
    • headers
      • { token }
    • decoded
      • {id: _id}
    • body
      • { title, content, tags, created_at, image, UserId }
  • response
    • 201: { title content tags created_at image UserId }
  • error:
    • Validation Error
- Token is decoded via JWT to get UserId.

- Multer is used to convert form data into object, then it is uploaded to google cloud storage and use the link from google cloud storage to google vision in order to get tags automatically.

Read Article

  • route:
    • GET /home
  • request
    • headers
      • { token }
    • decoded
      • {id: _id}
    • query
      • { myArticle }
  • response
    • 200: { title content tags created_at image UserId }
  • error:
    • 500 internal server error
- Token is decoded via JWT to get UserId.

- Query is used to find specific UserId.

Delete Article

  • route:
    • DELETE /:id
  • request
    • headers
      • { token }
    • decoded
      • {id: _id}
  • response
    • 200: { _id: ObjectId('') }
  • error:
    • 401 not authorized
User can not delete Article that does not belongs to his/her, it is authorized in middleware.

Update Article

  • route:
    • PATCH /:id
  • request
    • headers
      • { token }
    • decoded
      • {id: _id}
    • body
      • { title, content, tag, image }
  • response
    • 201: { title content tags created_at image UserId }
  • error:
    • 401 not authorized
- User can not update Article that does not belongs to his/her, it is authorized in middleware.

- Multer is used to convert form data into object, then it is uploaded to google cloud storage and use the link from google cloud storage to google vision in order to get tags automatically.

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.