j053noir / the-all-new-things

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

logo

The All new things

Public API that allows users to manage their personal tasks.

Installation

Clone this repository and run in the directory

git clone https://github.com/j053noir/the-all-new-things.git && cd the-all-new-things
npm install

In the root folder rename the ".env.example" file to ".env", and change the SERVER_PORT to an available port, eg:

SERVER_PORT=3000

Set the url, username and password of your MONGODB server,in the ".env" file

DATABASE_URL=
DATABASE_USERNAME=
DATABASE_PASSWORD=

If the database doesn't need username and password leave the fields empty.

Set any string that will be used as secret key to hash the JWT (JSON WEB TOKEN) in the ".env" file

TOKEN_SECRET=

Start the server

To start the server in production mode run:

npm start

To start the server in development mode run:

npm run dev

API V1.1

Route Method Parameters Body Description
/api/tasks GET - - Gets all tasks
/api/tasks POST description: string, author: string (userId) Creates a new task
/api/tasks/{id} GET id: number - Gets task with Id {id}
/api/tasks/{id} PUT id: number description: string, author: string (userId) Updates task with Id {id}
/api/tasks/{id} DELETE id: number - Deletes task with Id {id}
/api/users GET - - Gets all users
/api/users POST firstname: string, lastname: string, email: string Creates a new user
/api/users/{id} GET id: number - Gets user with Id {id}
/api/users/{id} PUT id: number firstname: string, lastname: string, email: string Updates user with Id {id}
/api/users/{id} DELETE id: number - Deletes user with Id {id}

Testing

Not yet available.

About

License:GNU General Public License v3.0


Languages

Language:JavaScript 100.0%