https://github.com/its-alex/node-api-project-template
This is a template for a NodeJS API
https://github.com/its-alex/node-api-project-template
api nodejs template
Last synced: 5 months ago
JSON representation
This is a template for a NodeJS API
- Host: GitHub
- URL: https://github.com/its-alex/node-api-project-template
- Owner: Its-Alex
- License: mit
- Created: 2019-03-10T23:05:32.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2022-12-30T21:38:05.000Z (over 3 years ago)
- Last Synced: 2025-10-30T17:48:21.145Z (8 months ago)
- Topics: api, nodejs, template
- Language: TypeScript
- Homepage:
- Size: 459 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# node-api-project-template
This is a node api project template to see how I work
## Node architecture
- `srcs` Sources folder
- `dist` Folder for generated files
- `tslint.json` TSLinter configuration file
- `nodemon.json` Nodemon config file to watch project
- `tsconfig.json` Typescript config file
## Code architecture
I always use the base like this:
- Logger defined in [srcs/logger.ts](/srcs/logger.ts)
- Swagger defined in [srcs/swagger.ts](/srcs/swagger.ts)
- Stateless configuration setup with env [srcs/config.ts](/srcs/config.ts)
- Routes folder with a gloabal router `index.ts` [srcs/routes](/srcs/routes)
- Controllers folder for express route handlers
[srcs/controllers](/srcs/controllers)
## Code standard
As a linter I like to use [standardjs](https://standardjs.com/) here I use tslint
with standard config
In `package.json` I often have at least five scripts:
- start
- build
- watch
- lint
- test
I prefer to use each CLI on code with npm like that we doesn't need to install
global package and CLI in node_modules will be used
## Docker
I create a [Dockerfile](/Dockerfile) with mutlistage who first build project then run the
outputed files in a second stage.
# License
[MIT](https://en.wikipedia.org/wiki/MIT_License)