1.0.5 • Published 2 years ago
@notamans/create-node-express-starter v1.0.5
node-express-starter
A basic Node.js and Express.js starter project.
Getting Started
Generate boilerplate using: npx @notamans/create-node-express-starter <PROJECT_NAME>
API URL: http://localhost:3000
Features
- Node.js and Express.js for building web applications
- TypeScript for type safety and maintainability
- dotenv for environment variable management
- Proper directory structure
- Jest for unit testing and integration testing
- ESLint and Prettier for code linting and formatting
- Winston for logging
- Custom global error handler. Removes the need for redundant
try/catchblocks.
Project Structure
The project is organized into the following directories:
src: Source code for the applicationserver.ts: Main entry point for the servercontrollers/: Controller logicerrors/: Custom errors for consistencymiddlewares/: Express middlewaresroutes/: API routesservices/: Business logic for the application
dist: Compiled JavaScript code for productiontests: Unit tests and integration tests for the application
Scripts
The following scripts are available:
npm run dev: Start the development servernpm run build: Compile the code for productionnpm run start: Start the production servernpm run test: Run unit tests and integration testsnpm run lint: Run ESLint for code linting and formatting
Environment Variables
The following environment variables are used:
- Server
PORT: Port number for the server (default: 3000)NODE_ENV: Node environment (default: development)
- Logging
LOG_LEVEL: Logger log level. For example, "info", "debug", etc.LOG_TO_CONSOLELOG_TO_FILELOG_TO_GRAFANAGRAFANA_HOSTGRAFANA_PORT
Contributing
Contributions are welcome! Please submit a pull request with your changes.