📦 Backend of cerbero-web.
The following commands must be executed inside the
web/backend/
directory.
Make sure to be on node version 18.17.1
, you can quickly swap between node versions with nvm
(node version manager).
npm i
The
.env
file must be located inside theweb/backend/
directory (web/backend/.env
).
Fill the .env
with the following values:
API_PORT="6666"
REDIS_URL="redis://localhost:6379"
SOCKET_PORT="6969"
Currently the API_PORT
value MUST be 6666
because in the development phase /api
requests are proxied only to that port (it is hardcoded in vite.config.ts
)
One of the easiest ways to bootstrap a redis-stack instance is running it with docker:
docker run -d -p "127.0.0.1:6379:6379" --name cerbero-redis-stack-dev redis/redis-stack:latest
npm run dev
If you have done everything correctly you should be able to see something like this in your terminal:
2012-12-12T12:00:00.000Z [INFO] API listening on port 6666
2012-12-12T12:00:00.000Z [INFO] Socket server listening on port 6969
2012-12-12T12:00:00.000Z [INFO] Connected to db redis://localhost:6379
The build process consists in compiling the typescript code into javascript, the compiled source will be stored into the
dist/
directory.
Most of the times you won't need to build anything manually, we use automated CI pipelines to handle that for us.
npm i
npm run build
npm run start
This variable is mandatory and specifies the port where the express api will start listening for incoming requests.
This variable is mandatory and specifies the redis connection string that the api will use to connect to the database.
This variable is mandatory and specifies the port where the TCP socket server will start listening for connections.