A basic Node.js Express application for demonstration purposes, suitable as a template for Node.js deployments.
- ✅ Express.js server with ES6+ modules
- ✅ Environment configuration with dotenv
- ✅ Proper error handling and graceful shutdown
- ✅ Health check endpoint
- ✅ JSON response format
- ✅ Development and production ready
-
Install dependencies:
npm install
-
Set up environment variables:
cp .env.example .env
Edit
.envfile to configure your PORT and other settings. -
Start the application:
# Production npm start # Development (with auto-restart) npm run dev
-
Test the application: Open your browser and visit
http://localhost:3000
GET /- Main endpoint returning app statusGET /health- Health check endpoint
| Variable | Description | Default |
|---|---|---|
PORT |
Server port number | 3000 |
NODE_ENV |
Environment mode | development |
.
├── index.js # Main application file
├── package.json # Project dependencies and scripts
├── .env.example # Environment variables template
├── .gitignore # Git ignore rules
└── README.md # This file
This application is ready for deployment to various platforms:
- Docker: Can be containerized easily
- Cloud platforms: Compatible with Heroku, Railway, Render, etc.
- VPS: Can be deployed on any VPS with Node.js support
MIT