- Click the big green button that says "Use this template".
- Select "Create a new repository" & proceed with the steps to create it.
- Clone it to your local machine and run
npm ito install dependencies. - Run it by using one of the following:
- Start up the DEVELOPMENT server with
npm run dev-start -- --port 3000 - Start up the PRODUCTION server with
npm run prod-start -- --port 3000 docker compose up -d<- Will run both the nodejs server and mongodb server (needed for auth and sessions)
- Start up the DEVELOPMENT server with
- Have a cert and key to use
- Put the path of said certs in
./bin/www.ts; lines 21 & 22 - If using docker, ensure you map host port to docker port, like
443:3000, when youdocker run
A quick reference to how you can build, push, and run this app as a docker container.
Navigate to the root directory of the project and run the commands.
Assumptions:
- You have a registry setup and are already logged in
- You have a Let's Encrypt authorized cert and privkey somewhere beyond
/etc/letsencrypton your host machine.
docker build . -t {registry}/{user name}/{project name}:{version}
If running locally only, pushing the image to a remote registry isn't required. The image exists locally since it was built locally.
docker push {registry}/{user name}/{project name}:{version}
docker compose up -d
-
The first set of double hyphens (
--) takes the argument passed in the second half of the command (--port 8080) and forwards it to thenode {filepath}command defined in the npm scriptdevstart.
It's thenpmway to forward on a CLI argument. -
In
src/routes/helpers/validate.tsthere is aHostAllowed()method that validates the host header. If you change the port number from the default8080, then you'll need to edit this too.