An API for the NJDOT Fuel UP iOS app written in Haskell using Servant.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
app
csv-data
src
test
.gitignore
LICENSE
README.md
Setup.hs
njdot-fuelup-api.cabal
njdot-fuelup.db
stack.yaml

README.md

NJDOT Fuel Up API

This is the backend for the njdot-fuelup app located here. This API was created with Servant.

How to run:

First get The Haskell Tool Stack if you don't already have it.

stack setup 
stack build
stack exec njdot-fuelup-api-exe

It will begin listening on listen on 127.0.0.1:80/

This api has two GET requests:

GET /bridges?latitude=<lat>&longitude=<lng>
GET /stations?latitude=<lat>&longitude=<lng>

The latitude and longitude parameters are required otherwise an empty list will be returned. Both endpoints return JSON formatted locations ordered by distance away from the specified coordinates.

If you want to recreate the database (sqlite3):

rm njdot-fuelup.db
stack ghci
Main Api Database Model> initializeDB

To run tests:

stack test