This API allows scheduling of meetings for No Sad Panda Initiative webinars.
- Install all components above and create a MongoDB instance.
npm install
to pull in the dependencies for the project.- You can edit
config.js
to set the port for the server and the location of your MongoDB instance. These are defaulted to 3000 and localhost:27017, respectively. - Run
npm start
from the main folder containing thepackage.json
file. - If you use Postman, a collection has been included for testing.
- URL
- meeting
- Method
POST
- Body example:
{
"contact": "Jesse Carrigan",
"email": "[email protected]",
"address": "5500 Phinney Ave. N., Seattle, WA 98103",
"datetime": "2016-11-08T10:00:00+08:00"
}
- Success response
- Status Code: 200
- Content:
{ "_id": "012345678910" }
- Error response
- Status Code: 400
- Content (example):
{ "error": "Missing meeting information" }
- Status Code: 500
- General error information.
- Status Code: 400
- URL
- meetings
- Method
GET
- Success response
- Status Code: 200
- Content:
{ "meetings": [ { "contact": "Jesse Carrigan", "email": "[email protected]", "address": "1006 East 58th Street, Tacoma, 98404, WA, US", "datetime": "2016-11-08T10:00:00+08:00" "timezone": 480 } ] }
- Error response
- Status Code: 500
- General error information.
- Status Code: 500
- URL
- meeting/:id
- Method
PUT
- Parameters example
- :id = 012345678910
- Body example
{
"contact": "Paul Carrigan",
"email": "[email protected]",
"address": "5500 Phinney Ave. N., Seattle, WA 98103",
"datetime": "2016-11-08T10:00:00+08:00"
}
- Success response
- Status Code: 200
- Content:
{ "updated": 1 }
- Error response
- Status Code: 400
- Content (example):
{ "error": "Missing meeting information" }
- Status Code: 500
- Returns general error information.
- Status Code: 400
- URL
- meeting/:id
- Method
DELETE
- Parameters example
- :id = 012345678910
- Success response
- Status Code: 200
- Content:
{ "deleted": 1 }
- Error response
- Status Code: 500
- Returns general error information.
- Status Code: 500
- The API saves a local time value in the datetime field on a meeting object, and the timezone as +/- the minutes from GMT to allow conversion on viewing the meeting.
- The datetime is assumed to be a date string in the format above.
- No particular validation is performed on the name or address field, but email is validated. The date string is also checked to ensure it is a valid date that can be stored.
- It would be great if this abstracted the database better. Right now, the use of MongoDB is baked into the API due to good support in Node, but if we wanted to change the database it would involve some refactoring.
- Validating email is included and is a pretty basic operation that seems reasonable. Having validation on the location would be good as well, perhaps through the Google Maps API (requires setting up developer/API keys, so was not done here).
- There's no auth or restrictions on the API, and given the information in the database (names, emails, etc.) it would probably be appropriate to have controls and security on it.