This weeks tasks consist of setting up the project in version control and creating a proof of concept Node.js server (in version control).
I decided to use Git via Github as my version control because I have used it before, in both my industrial year and personal projects. I decided to use Git because it is a decentralised model, this means that there is no "master" repo as there is with other version control software such as Subversion.
My Node.js Server
I set up a basic Node Express server, it was set up to listen to requests made to
/location. This is where the user submits their itinerary location.
The server for my application will only be accessed through HTTP requests, sent from the front-end of the application. I thought about repurposing a REST-client I had written previously, but thought it would be a little too much effort to bother with. I had a look around and found Postman.
Postman is a complete API development toolchain; you can share, test, monitor and document your APIs.
I am now using Postman to send HTTP requests to my Node.js server and ensure that the response is correct. I'm planning on building some test suites for my application using Postman too.
Getting location information
After setting up my basic server and starting to use Postman to test it, everything worked! The next step was to take the location from the HTTP request and send that off to the Foursquare API to get information on things to do in the area.
I also added some parameters to the request sent to Foursquare to limit the number of items it sent back and played around with some other parameters eg. Returning only places for food, returning only Tapas bars.
I noticed that the returned information included lots of things I didn't realise I could get:
You can see in the above example that you get the establishment's name, address, tagged categories (in this case Pub) along with a wealth of social information such as how many people are currently checked in.
This will be really helpful for displaying information about itinerary items in my application and in getting travel information between two items.
Subscribe to The Man Cave
Get the latest posts delivered right to your inbox