http-plus-static
v0.0.1
Published
provide static files for http module
Downloads
2
Readme
Serving static files for core http module
example
'use strict';
const port = 3000;
const http = require('http');
const url = require('url');
const Static = require('http-plus-static');
const app = http.createServer((req, res) => {
let uri = url.parse(req.url, true);
let file = new RegExp(/^\/static\/(.*)$/);
if(uri.pathname.match(file)){
Static.serve(req, res);
}
else{
res.writeHead(200, {'Content-Type' : 'text/html'});
res.end('Static files page.')
}
});
app.listen(port, () => {
console.log(`Server Up On Port => ${port}.`);
});