Experimental NYPL Branches API.
Nypl::BranchesApi is a Sinatra app. To run it locally you will need to clone the repository and run:
bundle install
You can set up whatever database you like and load data from
data/branches.sql
Start the server with the command
bundle exec rackup config.ru
The app looks for a DATABASE_URL
environment variable to know how to
connect to its database (à la Heroku). An easy way to set this is to
prepend it to the command, e.g.
DATABASE_URL=postgres://localhost/nypl_branches bundle exec rackup config.ru
You can then use curl or the like to retrieve the endpoints:
curl http://localhost:9292
All branches | / | http://localhost:9292/ |
One branch | /[branch abbreviation] | http://localhost:9292/SASB |
Multiple branches | /[branch abbreviation[,branch abbreviation[,...]]] | http://localhost:9292/SASB,YV,DY |
By borough | /borough/[bronx|manhattan|staten-island] | http://localhost:9292/borough/staten-island |
git checkout -b my-new-feature
)git commit -am 'Add some feature'
)git push origin my-new-feature
)