Skip to content

Jonathan-Mckenzie/node-typescript-starter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Node.js Typescript Starter

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

Getting started

  • Clone the repository
git clone https://github.com/Jonathan-Mckenzie/node-typescript-starter.git <project_name>
  • Install dependencies
cd <project_name>
npm install

Configuration

  • 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

Development

Launch in separate terminals:

  • npm run watch-build
  • npm run watch-node

Supports reloading on source edits

Production

  • npm run build

Node script located: dist/server.js

Testing

Any file name containing test will be ran using ts-jest

  • npm run test to run once
  • npm run test-watch to continuously run after edits

About

A starter app to kickstart your next node.js API server. Typescript, cors support, logger, controllers, API Unit Testing

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors