A starter app for your next node.js API project.
- Express
- Typescript
- Winston Logger
- Morgan with Winston stream
- CORS support
- JSON Body parsing
- Dotenv environment variables
- Routing-Controllers
- API Unit Testing with JEST and supertest
- Clone the repository
git clone https://github.com/Jonathan-Mckenzie/node-typescript-starter.git <project_name>
- Install dependencies
cd <project_name>
npm install
- Modify the variables found in
environment.ts - Edit environment variables by updating
.env
NODE_ENV: the node environment "development" or "production"
HOSTNAME: the node hostname e.g. "localhost"
PORT: port that node runs on e.g. 8080
WHITELIST: comma-separated host names, e.g."http://localhost:3000,https://postwoman.io"
LOG_DIR: where the winston logs get written to in production
Launch in separate terminals:
npm run watch-buildnpm run watch-node
Supports reloading on source edits
npm run build
Node script located: dist/server.js
Any file name containing test will be ran using ts-jest
npm run testto run oncenpm run test-watchto continuously run after edits