git clone https://github.com/tropen/node-todo-server.git
cd node-todo-server && cp .env-example .env
- paste mongo uri to .env file
npm install
dependencies installmentnpm start
start server
npm run start:dev
starts server in development mode with nodemon for faster development process.
To fix cors set NODE_ENV=dev
in .env file
Api is available at HOST:PORT
(default: http://localhost:5000
) with the only prefix /api/v1/
.
Server is configured to be in dev
mode. This disables CORS blocking for client-url http://localhost:3000
public:
POST /api/v1/signin
- returns AUTH_KEY
under authKey middleware:
-
GET HOST:PORT/api/v1/user
- get all users -
GET /api/v1/todo
- returns all todos with populated refs of user owners. -
POST /api/v1/todo
- inserts one new todo. Body should have essential fields.user_id
is ref to users collection =user.id
-
PATCH /api/v1/todo/toggle
- updatesdone
field in doc. request.body must have theid
of todo -
DELETE /api/v1/todo
- deletes doc from collection. request.body must have theid
of todo