A Doodle like API for scheduling events with friends. Event is created by posting a name and possible dates to the backend. Events can be queried from the backend and users can submit dates suitable for them.
- Clone or download this repository
- Run npm install in repo directory
- Install & start MongoDB
- Run npm start / node server.js in repo directory
- Make requests to localhost:3000
Creates a new event.
POST /api/v1/event/
Example body:
{
"name": "Epic lanparty",
"dates": [
"2018-02-19",
"2018-02-24",
"2018-03-01"
]
}
Example response:
{
"id": 0
}
Lists all events and their id's.
GET /api/v1/event/list
Example response:
{
"events": [
{
"id": 0,
"name": "Epic lanparty"
},
{
"id": 1,
"name": "Poker night"
},
{
"id": 2,
"name": "Housewarming party"
}
]
}
Shows a specific event.
Parameters: id
GET /api/v1/event/{id}
Example response:
{
"id": 0,
"name": "Epic lanparty",
"dates": [
"2018-02-19",
"2018-02-24",
"2018-03-01"
],
"votes": [
{
"date": "2018-02-19",
"people": [
"Michael",
"Peter",
"Jennifer",
"Lowel",
"Pekka"
]
},
{
"date": "2018-02-24",
"people": [
"Michael"
]
}
]
}
Adds a vote to an event.
Parameters: id
POST /api/v1/event/{id}/vote
Example body:
{
"name": "Robert",
"votes": [
"2018-02-19",
"2018-02-24"
]
}
Example response:
{
"id": "0",
"name": "Epic lanparty",
"dates": [
"2018-02-19",
"2018-02-24",
"2018-03-01"
],
"votes": [
{
"date": "2018-02-19",
"people": [
"Michael",
"Peter",
"Jennifer",
"Lowel",
"Pekka",
"Robert"
]
},
{
"date": "2018-02-24",
"people": [
"Michael",
"Robert"
]
}
]
}
Shows dates which are suitable for all participants.
Parameters: id
GET /api/v1/event/{id}/results
Example response:
{
"id": 0,
"name": "Epic lanparty",
"suitableDates": [
{
"date": "2018-02-19",
"people": [
"Michael",
"Peter",
"Jennifer",
"Lowel",
"Pekka",
"Robert"
]
}
]
}