A small Express API that demonstrates a clean server setup with a service route, health endpoint, JSON responses, and request logging.
- Express server on port
1198by default - Home endpoint
- Health endpoint
- Existing
a2rpAPI endpoint - Consistent
apiUrlfield in JSON responses [API]request and status logs- JSON body parsing with a small request-size limit
- JSON 404, malformed JSON, and oversized-body error responses
- Port validation and query-free request logs
- Node.js 18 or newer
Copy .env.example to .env if you want to override the default port.
PORT=1198
NODE_ENV=developmentnpm install
npm run devThe API starts at http://localhost:1198.
| Method | Path | Description |
|---|---|---|
| GET | / |
Service information |
| GET | /health |
Service health status |
| GET | /api/v1/a2rp |
Basic a2rp response |
Example response:
{
"apiUrl": "/health",
"status": "ok",
"service": "basic-nodejs-expressjs-hello-app"
}Ashish Ranjan
Full-Stack Web Developer
- Portfolio: ashishranjan.in
- GitHub: github.com/a2rp
- CodePen: codepen.io/ash1198
- LinkedIn: linkedin.com/in/aashishranjan
- Facebook: facebook.com/theash.ashish
- YouTube: Ashish Ranjan
- Email: ash.ranjan09@gmail.com
This project is licensed under the MIT License. See LICENSE.