This is a server for the GrubFinder application, whose purpose is to aggregate all grading and reporting for New York
City restaurants and to display them in a digestible (heh) way. You can find the corresponding grubfinder-client
code
over here.
You will need the following dependencies installed in order to run the application locally:
Run the npm
install target:
npm install
This will also run postinstall
to convert from es2015.
Use the start
target of npm
:
npm start
This will start the local Express server at http://localhost:3000
npm test
This project is configured to run on Heroku. See the Heorku documentation for more information.
Run
heroku create
to generate a new Heroku application. This will also add the heroku
git remote repository to your configuration:
$ git remote -v
heroku https://git.heroku.com/grubfinder-api.git (fetch)
heroku https://git.heroku.com/grubfinder-api.git (push)
origin git@github.com:benburton/grubfinder-server.git (fetch)
origin git@github.com:benburton/grubfinder-server.git (push)
Add NPM_CONFIG_PRODUCTION=false
so that Heroku will install development dependencies as well:
heroku config:set NPM_CONFIG_PRODUCTION=false
grubfinder-server
utilizes MongoDB as its data store. I'm not happy about this, for more than a few reasons. Add the
MongoLab sandbox addon to get a MongoDB instance running quickly and (relatively) painlessly:
heroku addons:create mongolab:sandbox
You may need to wait ~30 minutes for an instance to spin up.
If you set the MONGODB_URI
to the same value as the MONGODB_URI
Heroku environment variable, you should be able to
run the import from your local machine onto your Heroku instance using the following:
npm run inspection-import
Note that this is particularly slow, as the nature of the data and the speed of import is not friendly to keeping writes off the same records a very long duration of time. As a workaround, I introduced some rudimentary pessimistic locking using async-lock. It's not a pretty solution, but it does get the job done. Or:
I've also made a backup on Dropbox, and included a script to pull it down and migrate into a Heroku environment using
mongoimport
:
bin/import.sh
You should simply be able to run
git push heroku master
for a working deployment to your Heroku application.
- Add a file watcher to hot-reload code changes for easier development
- Add Swagger documentation
- Redirect pages for 404s
- Better/clearer 500 handling
- Add routes for processing data import over REST
- Jasmine unit tests that work
async
/await
keywords for controllers - Improve overall test coverage
- Load testing
- Move from MongoDB to Postgres. I should have started the project this way 😩
- Remove blank/inconsistent records
- Better data sanitization
- Consider putting the project into Docker for easier deployment
- Add more verbose logging
- Add geocoding to addresses from NYSDOH so the frontend can use Google Maps