Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including xstatic with all npm packages installed. Try it out:

var xstatic = require("xstatic")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

xstatic v0.0.3

Xstatic is a static file server handler for bringing up web sites quickly.


Xstatic is a minimal static file server for node.js. Basically, it's to be used when you need to get something simple up and running to serve http content.


If you use npm, then install static via npm. also remember to put it as a dependency in your package.json file.

npm install xstatic

If you don't use npm, you can just grab the static.js and copy it to your project locally.


For use in a simple http server:

var http = require('http');
var xstatic = require('xstatic');



Currently, the only thing you can change about how the files are served up is defining mimetypes. By default there is a list of common mimetypes to allow you to easily call xstatic() without any parameters. If you want to supply your own list of mime type mappings you can send it to xstatic like:

var http = require('http');
var xstatic = require('xstatic');

  mimeTypes: {
    "html": "text/html",
    "coffee": "text/coffeescript"


RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free