A simple REST API server built using NodeJS that helps maintain users and their todos. Created using NodeJS and Mongoose (Express framework and uses JSON Web Tokens for authentication)
Base URL of API: https://restful-api-todo-app.herokuapp.com
Routes:
- POST
/users
: Creates a user- Params:
username
,email
,password
,gender
,age
(optional),country
(optional)
- Params:
- POST
/auth/signin
:- Params:
email
andpassword
- Returns (if successful) an object containing a token with a subsequent authorized requests containing token as a param. This token must be passed as a parameter (key:
token
) in the body of all requests that require authorization.
- Params:
/users/:userid
- GET: get basic details of any user account
- PUT: update your user details
- DELETE: delete a user (yourself)
- GET
/users/:userid/pendingtodos
: Gets your k todos list. - GET
/users/:userid/completedtodos
: Gets your completed todos list. - DELETE
/users/:userid/completedtodos
: Deletes all your completed todos - GET
/users/:userid/delayedtodo
: All your pending todos that have been delayed (past deadline) - POST
/users/:userid/pendingtodos/share
: Not implemented (ability to transfer or share a todo with another user) - POST
/users/:userid/todos/
:- Params:
title
,status
(optional),description
(optional),priority
(optional),time
(optional)
- Params:
/users/:userid/todos/:todoid
:- GET: Get your todo item
- PUT: Update your todo item
- DELETE: Delete your todo item
Sample usage for a demo sample
user:
Method: POST
URL: https://restful-api-todo-app.herokuapp.com/auth/signin/
Request Body: email=sample%40sample.com&password=sample
/* Will receive a User ID and a Token which needs to be passed in subsequent requests (Requiring authorization). */
Method: GET
URL: https://restful-api-todo-app.herokuapp.com/users/5a0ca3cae3491000148153cc
Request Body: token={YOUR_JWT_TOKEN}