This is the backend module of the SpyLogic app. We are using Express to serve the API.
In production
(containerised) and development
modes we only serve the API. However, in prodlite
mode we also host
the UI through the Express server; the advantages of this are not needing to worry about CORS, and Cookies do not need
to be secure, as API and UI are same origin and same site.
npm ci
See the main README for setting up environment variables.
Start the API and hot-reload on changes:
npm run dev
Start the API and host the UI:
# If you've not yet built the frontend, do this first:
cd ../frontend && npm run build
cd ../backend
# Run the app:
npm start
There is a Dockerfile for running the API in a container.
To manually lint and format:
npm run lint
npm run format
We use Jest for the backend tests.
npm test