0.2.3 • Published 2 years ago

@funnyzak/http-server v0.2.3

Weekly downloads
-
License
Apache 2.0
Repository
github
Last release
2 years ago

js-standard-style npm license

a simple static http server

it is a simple static HTTP server node module.

Getting Started

  1. With npm, run npm install @funnyzak/http-server
  2. const StaticHttpServer = require('@funnyzak/http-server')

Usage

Here is an example that:

  1. create a new server instance
  2. start server.
const StaticHttpServer = require('@funnyzak/http-server');

const rootPath = process.cwd();
const server = new StaticHttpServer({
  host: '127.0.0.1', // host
  port: 16808, // listen port
  root: rootPath, // static root directory
  cors: true, // allow cors
  compress: true, // compress response
  cache: {
    maxAge: 3600,
    expires: true, // is set expires
    cacheControl: true, // is set cacheControl
    lastModified: true,
    etag: true
  }
});

// start server
server.serve();

// close server
setTimeout(server.dispose, 5000);

// conversion of resource path to virtual path under Root
var virtualUrl = server.parseVirtualPath(resourcePath);

Author

twitter/funnyzak
funnyzak

License

Apache-2.0 License © 2021 funnyzak

0.2.3

2 years ago

0.2.2

2 years ago

0.2.1

2 years ago

0.2.0

2 years ago

0.1.7

2 years ago

0.1.6

2 years ago

0.1.5

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.0

2 years ago

0.1.1

2 years ago