A basic REST API built with Node.js, TypeScript, and Express, protected by HTTP Basic Authentication.
-
Install dependencies:
npm install -
Create a
.envfile (see.env.example) with:PORT=3000 USERNAME=admin PASSWORD=secret
-
Development (with auto-reload):
npm run dev -
Build and run production:
npm run build npm start
Requires HTTP Basic Authentication using the USERNAME and PASSWORD from .env.
Query parameters:
name- the name to greet
Response:
{ "message": "Hello <name>" }Example:
curl -u admin:secret "http://localhost:3000/hello?name=World"