Pages
Contents
Guide
Installation
| npm install @xpulse/http --registry=https://npm.xpulse.one |
Minimal Example
| import http from '@xpulse/http'; |
| await http.init(); |
| http.route('GET', '/', (req, res) => { |
| res.send('<h1>xPulse</h1>'); |
| }); |
| http.route('GET', '/health', (req, res) => { |
| res.status(200).send('ok'); |
| }); |
| http.start(); |
| process.on('SIGTERM', () => http.stop()); |
Trailing Slash
The server enforces a trailing slash for all paths except /.
/health is redirected to /health/ (308).