This is the API and database source code for https://covid.laney.tech, an interactive map displaying cumulative Covid-19 cases and deaths for US counties. The front end source code can be found at https://github.com/laneysmith/covid-map.
Data from the NY Times covid-19-data project, based on reports from state and local health agencies.
Prerequisites
- You must have postgres installed on your machine (download here).
Starting the App
- Install project dependencies:
yarn install
- Run
yarn copy-env
to copy the.env.example
contents into a new.env
file. - Create a new postgres database called
covid_19
:psql # enter the interactive postgres terminal CREATE DATABASE covid_19; # create the database; if you choose to name it anything # other than covid_19, make sure you update the DATABASE_NAME env variable to match. \l # list all databases; confirm that covid_19 exists \q # exit postgres shell
- Run
knex migrate:latest --env development
(from the project root, not in psql) to run the migrations. This will add a table to the postgres database you created. - Start the server:
yarn start
- You should now be able to run
curl -i http://localhost:5000/covid
in your terminal to retrieve the latest data.
- Create a new postgres test database called
covid_19_test
:psql # enter the interactive postgres terminal CREATE DATABASE covid_19_test; # create the test database \l # list all databases; confirm that covid_19_test exists \q # exit postgres shell
- Run the tests:
yarn test