HTTP/2 static server
Keeping web development simple with a Koa-based HTTP/2 static server.
This server seamlessly HTTP/2 pushes all your files dependencies!
You never have to explicitly
PUSH assets to the client (unless you want to).
KISS hopes to simplify web development further by being extensible. By using plugins for polyfilling, transpilation and, eventually, package management, your build system will eventually become nonexistent. Your server is the new build system.
The following types of dependencies are parsed and HTTP pushed:
<script src>- scripts
<module src>- modules
<link rel="stylesheet">- stylesheets
<link rel="import">- HTML imports
@import "";- CSS imports
import ''- module imports
Dependencies that are conditional are not pushed automatically. If the client has a good chance of not using the dependency at all, extra latency is considered acceptable. Some examples are:
url()dependencies, many of which are wrapped in
@supportqueries or conditional selectors.
<link rel="stylesheet" media="">and
@import "" screen;.
System.import()s, which are always dynamically loaded.
KISS only supports iojs.
iojs does not yet support HTTP2. The current implementation uses spdy, which will most likely be the precursor for iojs' HTTP2 implementation. SPDY is sufficient for testing and educational purposes.
When streaming HTML, this middleware will buffer the response in memory. This is required because the current dependency parser does not support streaming (and probably never will). This is not a big issue as you probably shouldn't be using streaming templating systems anyways.
KISS is not production-ready and will most likely not be production-ready for a while. KISS will not attempt to become production-ready until load balancers such as nginx support HTTP2 push from upstream servers.
let koa =let app =let server =// mount the public folder at rootserver// expose `/client`serverapp
You can also view the example by cloning this repo and running
git clone git://github.com/kissweb/kisscd kiss./bin/kiss example
Then opening the page in your browser:
Be sure to accept the self-signed certificate!
KISS comes with a CLI for serving with a hope of replacing serve. To install:
npm i -g kiss
And to run:
Note that, by default, KISS uses a self-signed certificate. This is required as many browsers do not support HTTP2 without SSL. Acknowledge this from your browser to continue working.
Type the following for more information:
Create a new KISS instance.
var KISS =var server = 'public'cacheControl: '1 year'
root option is a shortcut for
You can use each instance:
Mount a server path. For example:
You never want to have more than a single instance of KISS on a server. By mounting multiple directories at once,
Folders resolve to the current working directory.
Add a custom ETag function.
By default, the etag module is used.
Function signature is
stats => <etag>.
Change the cache control header,
which defaults to
public, max-age=<1 year>.
maxAge could either be a time in
ms or a time string parsed using the ms module.
If hidden directories are supported,
paths whose fragments begin with
. are allowed.
Instead of enabling this option,
you should mount on paths like