oskaryil / tiptapp-api-challenge

Tiptapp api coding challenge

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

Create Todo /api/todo

curl --request POST \
  --url http://localhost:3000/api/todo \
  --header 'content-type: application/x-www-form-urlencoded' \
  --data title=Buy%20groceries

Delete Todo /api/todo/:id

curl --request DELETE \
  --url http://localhost:3000/api/todo/5b3b2d14fbfa2a6fd938e0f2

Update Todo /api/todo/:id

curl --request PATCH \
  --url http://localhost:3000/api/todo/5b3b2f6d98b4658664291426 \
  --header 'content-type: application/x-www-form-urlencoded' \
  --data done=true

Fetch all todos /api/todo

curl --request GET \
  --url http://localhost:3000/api/todo

Events

Fetch all events /api/events

curl --request GET \
  --url http://localhost:3000/api/events

Fetch events based on event name/type /api/events/name

curl --request GET \
  --url http://localhost:3000/api/events/marked_as_done

About

Tiptapp api coding challenge


Languages

Language:JavaScript 100.0%