A simple Express.js API application with basic security and logging middleware.
- Node.js (v14 or higher)
- npm (v6 or higher)
- Install dependencies:
npm install
- Create a
.env
file in the root directory with the following content:
PORT=3000
NODE_ENV=development
Development mode (with auto-reload):
npm run dev
Production mode:
npm start
.
├── src/
│ └── server.js # Main application file
├── .env # Environment variables (create this file)
├── package.json # Project dependencies and scripts
└── README.md # This file
npm start
: Run the application in production modenpm run dev
: Run the application in development mode with auto-reloadnpm test
: Run tests (when implemented)
- express: Web framework
- cors: Cross-Origin Resource Sharing middleware
- helmet: Security middleware
- morgan: HTTP request logger
- dotenv: Environment variable management
- nodemon: Auto-reload during development
- jest: Testing framework