Node.js Express API with TypeScript. Supports MongoDB
This generator will help you to build your own Node Express Web API using TypeScript. You'll be able to connect to your MongoDB database. Feel free to leave your suggestions and help us to improve this generator.
First, install Yeoman and generator-ts-node-api using npm (we assume you have pre-installed node.js).
npm install -g yo
npm install -g generator-ts-node-api
Then generate your new project:
yo ts-node-api
To start the application in development mode, run:
npm run dev-server
The developer mode will watch your changes then will transpile the TypeScript code and re-run the node application automatically.
First, create the prod.env
file inside the config
folder. Make sure that file contains all your production environment variables, like the dev.env
file.
To build the API, run:
npm build
Then, start the application or deploy the files in dist
directory:
npm start
- Yeoman has a heart of gold.
- Yeoman is a person with feelings and opinions, but is very easy to work with.
- Yeoman can be too opinionated at times but is easily convinced not to be.
- Feel free to learn more about Yeoman.
MIT © Caio Souza & Petrus Cyrino