A nodejs server running express to expose a REST api.
Dependent on component storage
for, well, data storage.
- ExpressJS routing guide
- Note the paragraph
Response methods
, especially the use ofres.json()
to avoid unecessary transformations
- Note the paragraph
- ExpressJS cors middelware
- node and redis via docker
- nodejs and express example from workshop
A Hands-On Introduction to modern web based A&A
- HTTP status codes
- Backend has no public endpoint in production, it is only available inside the same namespace
- Storage credentials
The env varREDIS_PASSWORD
must be set both in backend and storage container- Development configuration, see below
- Production configuration, set as secret
REDIS_PASSWORD
for both backend and storage container in Radix
The ./docker-compose.yaml contains everything we need to run a development environment.
Note that only the backend
component will be a development container, the rest will run production builds based on their respective dockerfiles.
Make sure the shared .env
file is available in your local repo, see ../README/Storage credentials in shared .env file
We make use of docker-compose .env
file to insert credentials as environment variables in the storage and backend container.
- Simply create your own
.env
file in root of repo - and add variables in key=value format
REDIS_PASSWORD=<insert-your-password>
Make sure .env
is gitignored!
docker-compose up --build
docker exec -it backend_development bash
Read the file dockerfile.backend
for configuration details.
docker build -t backend -f dockerfile.backend .
docker run -it --name backend backend