Skip to content
This repository has been archived by the owner on Jan 25, 2024. It is now read-only.
/ lunchwatch-api Public archive

🍱 LunchWatch Menu Aggregator API

License

Notifications You must be signed in to change notification settings

jtiala/lunchwatch-api

Repository files navigation

🍱 LunchWatch Menu Aggregator API

LunchWatch is a lunch menu aggregator web app. The app is currently aggregating menus from restaurants in Oulu, Finland.

This repository contains Node.js GraphQL and REST APIs, and also includes scheduled menu importers. The actual web app is located in a separate repository. Issues concerning the UI should be discussed in that repository.

Pre-requisites

Development

Duplicate .env.example as .env and edit in your details

cp .env.example .env

Start containers

docker-compose up

Run migrations and seed the database with some initial data

docker exec -d lunchwatch-api_api_1 npm run migrate
docker exec -d lunchwatch-api_api_1 npm run seed

Navigate to http://localhost:8080/graphql to verify application is running.

Production

Make sure you have browserless/chrome Docker container or similar instance of headless Chromium running and accepting websocket connection at URI defined in CHROME_WS_ENDPOINT environment variable.

Duplicate .env.example as .env and edit in your details

cp .env.example .env

Install and build

npm install
npm run build

Migrate and seed the database

npm run migrate
npm run seed

Start the app

npm run start

Creating new migrations and seeds

The project uses Knex for query building and database migrations. New migrations and and seeds can be created with these commands.

docker exec -d lunchwatch-api_api_1 npm run migrate:make <name>
docker exec -d lunchwatch-api_api_1 npm run seed:make <name>

For example

docker exec -d lunchwatch-api_api_1 npm run migrate:make create_restaurants_table
docker exec -d lunchwatch-api_api_1 npm run seed:make uniresta_seeds

Contributing

Contributions are most welcome! If you would like to contribute to this project, please discuss the changes you want to make in the project's issues first!

License

This project is open source software licensed under the MIT license. For more information see LICENSE.