Inspiration
I was inspired by the summer hackathon to try my hand at my first RESTful API. Neal and Richard have been incredibly encouraging and I couldn't not try.
How it works
The API is brutally simple. Each president has his own URI. It uses express routing in conjunction with a JSON file to serve the data back to the user.
For example, using the OpenShift demo host, a call to https://rosegarden-medmond78.rhcloud.com/api/1 yields
{"Presidency":"1","FULLNAME":"George Washington","WIKI":"http://en.wikipedia.org/wiki/George_Washington","DATETOOKOFFICE":"30/04/1789","DATELEFTOFFICE":"4/03/1797","PARTY":"Independent ","HOMESTATE":"Virginia"
Based on feedback I received, it's been recently updated to allow you to call individual properties, so a call to https://rosegarden-medmond78.rhcloud.com/api/1/HOMESTATE yields
{"HOMESTATE":"Virginia"}
For now, the properties is case-sensitive and must be all-caps. Not ideal but I'm still learning :)
Challenges I ran into
Challenges were minimal and limited to the syntax of the express routing and getting it going on OpenShift
Accomplishments that I'm proud of
Routing was new for me and I'm glad I got it working. This was especially true after receiving the feedback on routing to individual properties from Neal. It was great feedback and forced my further to learning about Express routing and parameters.
What I learned
Everything you see in the code.
What's next for Rose Garden
While the API is really quite simple, I'm excited because I think it could be useful for a teacher or a group looking for a simple API to test/ learn/ hack with. Imagine a bunch of high schoolers being challenged to write a Presidential Reference App. No need to code the backend, here it is. :)
Log in or sign up for Devpost to join the conversation.