owasp-mastg
owasp-mastg copied to clipboard
Add pure-http
By submitting this pull request, I promise I have read the contribution guidelines twice and ensured my submission follows it. I realize not doing so wastes the maintainers' time that they could have spent making the world better. 🖖
⬆⬆⬆⬆⬆⬆⬆⬆⬆⬆
pure-http is a simple web framework for Node.js with zero dependencies and low latency. That helps you use the middleware and router in native HTTP.
Usage
Basic server:
const pureHttp = require('pure-http');
const app = pureHttp();
app.get('/', (req, res) => {
res.send('Hello world');
});
app.listen(3000);
Exist server:
const http = require('http');
const pureHttp = require('pure-http');
const server = http.createServer();
const app = pureHttp({ server });
app.listen(3000);
Secure server:
const https = require('https');
const pureHttp = require('pure-http');
const server = https.createServer({
key: ...,
cert: ...,
});
const app = pureHttp({ server });
app.listen(3000);
Router
const { Router } = require('pure-http');
const router = Router();
router.get('/', (req, res) => {
res.send('Hello world');
});
/* ... */
const pureHttp = require('pure-http');
const app = pureHttp();
app.use('/api', router);
app.listen(3000);