Giter Club home page Giter Club logo

vue-overvlow's Introduction

HACKTIV OVERFLOW

##Link deploy
hacktiv-overflow.adielpratama.com

Installation

run this command before use this application :)

npm i

npm run dev

Environment

PORT= your port

SECRET_PASSWORD= secret password for jwt

uri=your mongo db collection url

This table below is routes of User:


Routes Method Head/body Response Description
/user POST Body
username: String
password:String
email:String
Success
200 OK
Fail
500 Internal Server Error
create User
/user/signIn POST Body
email: String
password: String
Success
201 Created
Fail
404 Not Found
manual Login

This table below is routes of question:


Routes Method Head/body Response Description
/question GET Headers
token: String
Success
200 OK
Fail
400 Bad Request
500 Internal Server Error
Get all question
/question/userQuestion GET Headers
token: String
Success
200 OK
Fail
400 Bad Request
500 Internal Server Error
Get all user's question
/question/:id GET Headers
token: String
Success
200 OK
Fail
400 Bad Request
500 Internal Server Error
Get one of question
/question/:id PUT Headers
token: String
Body
title: String
description: String
Success
201 OK
Fail
400 Bad Request
500 Internal Server Error
update one of question
/question/:id POST Headers
token: String
Params
id: String
Body
vote: String
Success
200 OK
Fail
401 Authorization Error
500 Internal Server Error
vote one of question
/question POST Headers
token: String
Body
title: String
description: String
Success
201 Created
Fail
500 Internal Server Error
Create question
/question/:id DELETE Headers
token: String
Success
200 OK
Fail
401 Authorization Error
500 Internal Server Error
Delete one Of question

This table below is routes of Answer:


Routes Method Head/body Response Description
/answer POST Headers
token: String
Body
title: String
description: String
question: STRING questionID
Success
201 Created
Fail
500 Internal Server Error
Create answer
/answer/:id POST Headers
token: String
Params
id: String
Body
vote: upvote/downvote
Success
201 Created
Fail
500 Internal Server Error
Vote answer
/answer/:id PUT Headers
token: String
Body
title: String
description: String
Success
200 OK
Fail
400 Bad Request
500 Internal Server Error
update user answer

/question response

//in GET response, you will get array, 
// in POST response, you will get object of new question

/**
 * GET ALL question  
 * 
 * */
[
  {
    "upvotes": [
      "5d6779f58945384ff6b6e701"
    ],
    "downvotes": [],
    "answer": [
      {
        "upvotes": [
          "5d6779f58945384ff6b6e701"
        ],
        "downvotes": [],
        "totalvotes": 1,
        "_id": "5d6781885d50ea0d6bbd46fa",
        "title": "Sory salah lagi",
        "description": "Test lagi<br>",
        "question": "5d677bff8945384ff6b6e702",
        "user": {
          "_id": "5d6779f58945384ff6b6e701",
          "username": "Bayu",
          "email": "[email protected]"
        },
        "createdAt": "2019-08-29T07:40:56.980Z",
        "updatedAt": "2019-08-29T07:47:19.723Z"
      }
    ],
    "totalvotes": 1,
    "_id": "5d677bff8945384ff6b6e702",
    "user": {
      "_id": "5d6779f58945384ff6b6e701",
      "username": "Bayu",
      "email": "[email protected]"
    },
    "title": "Test baru",
    "description": "Lorem ipsum",
    "createdAt": "2019-08-29T07:17:19.850Z",
    "updatedAt": "2019-08-29T07:44:13.261Z"
  },
]
/**
 * CREATE question
 * 
 * */
{
  "upvotes": [],
  "downvotes": [],
  "answer": [],
  "totalvotes": 0,
  "_id": "5d679fc071585a3e83c40955",
  "user": "5d660b710093e75a9c1ec45b",
  "title": "Machine learning with HTML",
  "description": "Joke hehe",
  "createdAt": "2019-08-29T09:49:52.036Z",
  "updatedAt": "2019-08-29T09:49:52.036Z"
}
/**
 * update question (new data) 
 * 
 * */
{
  "upvotes": [],
  "downvotes": [],
  "answer": [],
  "_id": "5d65f387848a512545f0e73a",
  "user": "5d65edb7bf9140176069e91d",
  "title": "How to make website ?",
  "description": "With Wix.com",
  "createdAt": "2019-08-28T03:22:48.000Z",
  "updatedAt": "2019-08-28T04:11:01.282Z"
}
/**
 * DELETE QUESTION
 * 
 * */
{
  "ok": 1,
  "n": 1,
  "deletedCount": 1
}
/**
 * Vote QUESTION
 * 
 * */
{
  "upvotes": [
    "5d6779f58945384ff6b6e701"
  ],
  "downvotes": [
    "5d65edb7bf9140176069e91d"
  ],
  "answer": [
    "5d6781885d50ea0d6bbd46fa"
  ],
  "totalvotes": 0,
  "_id": "5d677bff8945384ff6b6e702",
  "user": "5d6779f58945384ff6b6e701",
  "title": "Test baru",
  "description": "Lorem ipsum",
  "createdAt": "2019-08-29T07:17:19.850Z",
  "updatedAt": "2019-08-29T07:44:13.261Z"
}

/answer response

/**
 *  create Answer
 **/
{
  "upvotes": [],
  "downvotes": [],
  "totalvotes": 0,
  "_id": "5d66ad248f61902439c1187b",
  "title": "How to loop",
  "description": "Lorem ipsum",
  "question": "5d6616f9e582ea6f9b8e4691",
  "user": "5d65edb7bf9140176069e91d",
  "createdAt": "2019-08-28T16:34:44.133Z",
  "updatedAt": "2019-08-28T16:34:44.133Z"
}
/**
 *  vote Answer
 **/
{
  "upvotes": [],
  "downvotes": [
    "5d660b710093e75a9c1ec45b",
    "5d65edb7bf9140176069e91d"
  ],
  "totalvotes": -1,
  "_id": "5d661c085085f67ca699c4c7",
  "title": "What is promises ?",
  "description": "an async handler method",
  "question": "5d6616f9e582ea6f9b8e4691",
  "user": "5d660b710093e75a9c1ec45b",
  "createdAt": "2019-08-28T06:15:36.304Z",
  "updatedAt": "2019-08-28T16:54:15.044Z"
}

END

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.