Clean class based Node / Typescript
REST API Architecture.
An ideal template for those who want to get rid of the hassle and start developing directly.
- Control your controllers from a single point.
- Manage settings such as CORS and static folders centrally.
- Easy to implement it.
- Typescript
- Express.js
- Node.js (16.x)
- Clone the repository.
git clone https://github.com/mariocoski/rest-api-node-typescript.git
- Install dependencies.
npm install or yarn
- Configure your environment variables in
config
file.
{
"server": {
"env": "development",
"port": 3000,
// enable if application has static file(s)
//"staticFolders": ["folderName2", "folderName2"],
"cors": {
"origins": null,
"methods": null,
"allowedHeaders": null,
"exposedHeaders": null,
"credentials": null,
"maxAge": null,
"preflightContinue": null,
"optionsSuccessStatus": null
}
}
}
- Build your api.
npm run build or yarn build
- Start your api.
npm run start or yarn start
npm run dev or yarn dev
For check is api working.
http://localhost:3000/health
Result:
{
"success": true,
"code": "API_IS_WORKING",
"message": "Api is working."
}
This project is licensed under the MIT License - see the LICENSE file for details.