SKYTASKR! is a simple to-do list app build with HTML, CSS, jQuery, Express.js, MongoDB and Mongoose at Skylab Coders Academy Full Stack Web Development Bootcamp.
To first need to set some environment variables for this app
DB_URI=localhost:27017/<%YOUR_DB_NAME%>
PORT=<%YOUR_PORT%>
These environment variables can be set in an .env
file located in the root of the folder
Or you can directly pass them when calling the app
DB_URI=localhost:27017/<%YOUR_DB_NAME%> PORT=3000 npm run dev
Note: You also need to have a mongo daemon running
You can launch the app using some NPM scripts:
npm start
Will launch the app and will install the dependencies (npm & bower) automaticallynpm run dev
Will launch the app w/ nodemon so it will restart itself when any file of the project is modified and savednpm run dev:debug
Will launch thenpm run dev
script w/ lots of debugging info about the app
All these endpoints will start locally w/ http://localhost:3000
Example: http://localhost:3000/tasks
Get list all tasks
curl localhost:3000/tasks
Get list all completed tasks
curl localhost:3000/tasks/completed
Get list all pending tasks
curl localhost:3000/tasks/pending
To add a task. It only need a title value. The rest of the values (completed, createdAt, id) will be added automatically
curl -X POST --data "title=Buy water" localhost:3000/tasks
To update a task. It needs to receive one or more of the following values: completed, title (even if not all are being updated).
curl -X PUT --data "completed=true" localhost:3000/task/59255d4b9104a81def8eef5a
curl -X PUT --data "title=Buy more water" localhost:3000/task/59255d4b9104a81def8eef5a
To remove a task. Only by passing an id the task will be removed.
curl -X DELETE localhost:3000/task/59255d4b9104a81def8eef5a