http_and_https

1.0.2 • Public • Published

http-https

const t = require('http_and_https');
const fs = require('fs');


const httpServer = t.http.createServer((req, res)=>{
    res.writeHead(301,{Location: `https://${req.headers.host}${req.url}`});
    res.end();
}).listen(80);

const httpsServer = t.https.createServer({key: fs.readFileSync('key.pem'),cert: fs.readFileSync('cert.pem')},(req, res)=>{
    res.writeHead(200);
    res.end("hello world\n");
}).listen(443);

Dependents (0)

Package Sidebar

Install

npm i http_and_https

Weekly Downloads

1

Version

1.0.2

License

ISC

Unpacked Size

2.38 kB

Total Files

5

Last publish

Collaborators

  • trebor