tiptapp-api-challenge
Tiptapp api coding challenge
Production url: https://tiptapp-challenge.herokuapp.com/
Setup
Prerequisities
- MongoDB Server
- Node.js > v.6
Make a copy of the .env.example
file and rename it to .env
. Fill this file with your own environment variables.
Here's an example:
APP_NAME=Todo API
PORT=3000
MONGO_URL_DEV=mongodb://localhost/tiptapp-todo-api-dev
MONGO_URL_PROD=mongodb://localhost/tiptapp-todo-api-prod
MONGO_URL_TEST=mongodb://localhost/tiptapp-todo-api-test
Install depencendies
Run $ npm install
Start the server
Run $ npm start
API
There are two different groups of endpoints:
- Todo @
/api/todo
- Events @
/api/events
Todo
/api/todo
Create Todo curl --request POST \
--url http://localhost:3000/api/todo \
--header 'content-type: application/x-www-form-urlencoded' \
--data title=Buy%20groceries
/api/todo/:id
Delete Todo curl --request DELETE \
--url http://localhost:3000/api/todo/5b3b2d14fbfa2a6fd938e0f2
/api/todo/:id
Update Todo curl --request PATCH \
--url http://localhost:3000/api/todo/5b3b2f6d98b4658664291426 \
--header 'content-type: application/x-www-form-urlencoded' \
--data done=true
/api/todo
Fetch all todos curl --request GET \
--url http://localhost:3000/api/todo
Events
/api/events
Fetch all events curl --request GET \
--url http://localhost:3000/api/events
/api/events/name
Fetch events based on event name/type curl --request GET \
--url http://localhost:3000/api/events/marked_as_done