Fetch dependencies:
npm install
To run the build, use either of the following:
# For production build:
node build.js prod
# For development build:
node build.js dev
# or
node build.js
Express app listens on port 3000
.
npm start
Run Mongo DB. Express app connects to express-ts
database by default.
If you use Docker, you can run the following container:
docker run --detach --publish 27017:27017 --name express-ts-mongo mongo
Express app is written in TypeScript and transpiled files are placed in dist/
. The entry point of the app is www.js
module. It runs the transpiled JS files in dist/
.
If you use Visual Studio Code, there are configurations to help you with debugging the app.
- Open app in VS Code
- Press
Ctrl + Shift + B
(Run Default Build Task) to watch TS files in "src/" and transpile them in background - Press F5 to debug TS files
Mongo Db connection string can be set in the config files or as a APP_MONGO
environment variable.
If an app configuration is available both in a file and as environment variable, environment variable wins.