Use Node.js version 20.10.0
.
Run npm install
.
Set up Postgres database (see "Using Postgres" section below).
Run npm run dev
. The app can be accessed at http://localhost:3000
.
Run npm run build:local
to build the app to be run locally. The built app can be run using npm start
, and accessed at http://localhost:3000
.
The development version of the app can similarly be built using npm run build:dev
, and the production version using npm run build:prod
.
Run docker build --build-arg ENVIRONMENT=local -t tracker-node -f Dockerfile.node .
to build the image for the locally-runnable app.
The container can be run using docker run -p 3000:3000 tracker-node
.
To build the development or production app instead, replace local
with dev
or prod
in the build command, e.g. for production: docker build --build-arg ENVIRONMENT=prod -t tracker-node -f Dockerfile.node .
.
- Install Postgres using Homebrew:
brew install postgresql
- Start the Postgres server:
brew services run postgresql
, orbrew services start postgresql
to have it restart on reboot - Create a database:
createdb atlas-tracker
- In the app directory, run
npm run migrate
to migrate up
- Run
psql atlas-tracker
- Enter a query, e.g.
SELECT * FROM hat.users;
- Enter
\q
to exit
In order to run tests, a test database must be created:
createdb atlas-tracker-test
Once this has been done, tests may be run with npm run test
.