Code Monkey home page Code Monkey logo

nohost's Introduction

nohost

A web server in your web browser.

Running a local web server allows for easier testing and development without the need for a network. The nohost web server takes this a step futher, and allows web sites to be hosted inside the browser without any server or network.

nohost was created in order to make it easier to do in browser, live previews of complex web sites and applications that span many files.

###Demo

You can try a demo here.

Like any web server, you must first install what you want to serve. The nohost server uses Filer in order to create a filesystem within the browser. Files are then installed in the filesystem using the ?install boot option, and choosing a disk image (*.zip). A demo disk image is included, which can be installed by doing the following:

http://humphd.github.io/nohost?install=webmaker-kits-gh-pages.zip

Once installed, the filesystem will survive the server being started and stopped (i.e., closing the window). If you want to clear the filesystem, use the ?reset boot option:

http://humphd.github.io/nohost?reset

Now that files are installed into the fileystem, you can browse them by adding a path to the query string:

Any path not found in the filesystem will produce a 404:

http://humphd.github.io/nohost/?/nothere

###How it Works

nohost boots the web server whenever you load its index.html page. Boot options are read from the query string and then actions are taken using the filesystem. Since the filesystem survives between executions of the page, there is stability between various requests.

Each request for a path involves rewriting. The file at a given path is read and parsed, and processed so as to inline any external resources (e.g., images, stylesheets, etc). When the document is done being processed, it is again turned into text, and document.write is used to replace the web server's boot page with the new content. Some special pages are synthesized, similar to how a normal web server works. For example: directory listings and images.

nohost's People

Contributors

humphd avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.