npm.io
1.4.4 • Published 3 years agoCLI

static-koa-server

Licence
MIT
Version
1.4.4
Deps
2
Size
4 kB
Vulns
0
Weekly
0
Stars
2
Install scriptsThis package runs scripts during installation (preinstall/install/postinstall)

static-koa-server

a package can specify a folder as a local static resource server from the command line

Getting started

  • Install node.js
  • Install npm package globally npm -g install static-koa-server
  • Go to the folder you want to serve which has html file in dist
  • Run the server static-server

Options

-p, the port to listen to for incoming HTTP connections,
-o, open browser
-d, specifies a folder as the root path of the static resource server

Configuration File

You can create a file named static.config.js in the current directory where the command is executed to gain more capabilities through configuration information.

For example, you can use the responseHeaders property to configure the response headers of a static resource server.

module.exports = {
    responseHeaders: {
        'Cache-Control': 'max-age=2000'
    }
}

Keywords