It is a simple static HTTP server Node.js module.
Getting Started
- With npm, run
npm install @funnyzak/http-server const StaticHttpServer = require('@funnyzak/http-server')
Usage
Here is an example that:
- create a new server instance
- start server.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
| const StaticHttpServer = require('@funnyzak/http-server');
const rootPath = process.cwd(); const server = new StaticHttpServer({ host: '127.0.0.1', port: 16808, root: rootPath, cors: true, compress: true, cache: { maxAge: 3600, expires: true, cacheControl: true, lastModified: true, etag: true } });
server.serve();
setTimeout(server.dispose, 5000);
var virtualUrl = server.parseVirtualPath(resourcePath);
|
License
Apache-2.0 License © 2021 funnyzak