Code Monkey home page Code Monkey logo

fancy-todo-1's Introduction

fancy-todo

Base URL

http://localhost:3000

Method URL Headers Data Description
POST /users/register None username: string
email: string
password: string
Register a new user
POST /users/login None user: string
password: string
Login an existing user using email or username
POST /users/loginOAuth None token: string Login or register using Google OAuth2 service
POST /users/relog token:string None Get user data after page refresh
GET /todos/ token:string None Get user's personal todo
GET /todos/:projectId token:string None Get project's todo that the user is a member of
POST /todos token:string name:string
description:string
due_date:date
project:ObjectId(opt.)
Create a new personal todo. If project is included, it will create a new project todo instead
PATCH /todos/:id token:string status:string Change a todo status from active to completed and vice versa
DELETE /todos/:id token:string None Delete a todo with the specified id
GET /projects token:string None Get projects detail that the user is a member of
POST /projects token:string name:string Create a new project
GET /projects/:projectId token:string None Get a project detail that the user is a member of
POST /projects/:projectId/:userId token:string userId:string Invite a user to a project
DELETE /projects/:projectId/:userId token:string userId:string Remove a user from a project
DELETE /projects/:projectId token:string projectId:string Delete a project

Register User

Register a new user and return JWT, user ID, and username.

  • URL

    POST /users/register

  • Data Params

    username=[string]
    email=[string]
    password=[string]

  • Success Response:

    • Code: 201
      Content:
      {
      "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjVlMWJhZDMyYWMxMjk3MDI1ZjcwYWQyNiIsInVzZXJuYW1lIjoiY2FybCIsImlhdCI6MTU3ODg3MjExNX0.maiKcTQvFo1ipLII-UKhpcQiX7JxceyrgIgdF_hnKQU",
      "id": "5e1bad32ac1297025f70ad26",
      "username": "carl"
      }
  • Error Response:

    • Code: 400 BAD REQUEST
      Content:
      {"message": "Username is required\nEmail is required\nPassword is required\n"}
  • Sample Call:

    $.ajax({
      method: 'POST',
      url: `${BASE_URL}/users/register`,
      data: {
        username,
        email,
        password
      }
    })

User Login

Login an existing user and return JWT, user ID, and username.

  • URL

    POST /users/login

  • Data Params

    user=[string]
    password=[string]

  • Success Response:

    • Code: 200
      Content:
      {
      "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjVlMWJhZDMyYWMxMjk3MDI1ZjcwYWQyNiIsInVzZXJuYW1lIjoiY2FybCIsImlhdCI6MTU3ODg3MjgxMH0.mUcdST6iVjSnhWqhuAKzMf8i4Uj54H9SJ-sC0lY1kL4",
      "id": "5e1bad32ac1297025f70ad26",
      "username": "carl"
      }
  • Error Response:

    • Code: 400 BAD REQUEST
      Content:
      {"message": "Wrong credentials"}
  • Sample Call:

    $.ajax({
      method: 'POST',
      url: `${BASE_URL}/users/login`,
      data: {
        user: username || email,
        password
      }
    })

fancy-todo-1's People

Contributors

carl-hermawan avatar dmtrxw avatar

Watchers

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