Giter Club home page Giter Club logo

todo-node's Introduction

todo-node

REST API for a Todo app using Node. (This is just an API)*

The app uses MongoDB. See config/config.js file to associate your DB credentials.

On creating or logging a user a x-auth token will be returned in header that can be used to create other requests to view, create, update and delete Todos. x-auth token should be sent as a header property to do those tasks. Log out route will delete that x-auth token.

To get the app

git clone https://github.com/rishijavia/todo-node.git
cd todo-node
npm install

To run the app

node server/server.js

To run the tests

npm test

Routes

  1. Creating a User:

url: POST /users

JSON body:

{
  "email":"[email protected]"
  "password":"abc123!"
}
  1. Logging in

url: POST /users/login

JSON body:

{
  "email":"[email protected]"
  "password":"abc123!"
}
  1. Logging out

url: DELETE /users/me/token

header:

{
  'x-auth' : <auth token>
}
  1. Profile

url: GET /users/me

header:

{
  'x-auth' : <auth token>
}
  1. Get all Todos

url: GET /todos

header:

{
  'x-auth' : <auth token>
}
  1. Get Todo by id

url: GET /todos/:id

header:

{
  'x-auth' : <auth token>
}
  1. Create a Todo

url: POST /todos

JSON body:

{
  "text" : "Text for my Todo" //mandatory field
  "completed" : true/false //optional field, defaults to false
}

header:

{
  'x-auth' : <auth token>
}
  1. Update a Todo

url: PATCH /todos/:id

JSON body:

{
  "text" : "Text for my Todo" //mandatory field
  "completed" : true/false //optional field, defaults to false
}

header:

{
  'x-auth' : <auth token>
}
  1. Delete a Todo

url: DELETE /todos/:id

header:

{
  'x-auth' : <auth token>
}

Schema

  • User

    • email
      • String
      • required
      • unique
      • min length - 1
    • password
      • String
      • required
      • min length - 6
    • tokens
      • Access
        • String
        • required
      • Token
        • String
        • required
  • Todo

    • text
      • String
      • required
      • min length - 1
    • completed
      • Boolean
      • default: false
    • completedAt
      • Number
      • null
    • _creator
      • ObjectId
      • required

todo-node's People

Contributors

rishijavia avatar

Watchers

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