Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Simple script for launching web applications via node.js

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 bin
Octocat-spinner-32 test
Octocat-spinner-32 .gitignore
Octocat-spinner-32 README.md
Octocat-spinner-32 package.json
README.md

serverify

Starts a server running browserify so you can quickly develop web applications using the node.js/npm package system.

Usage

Here is how to run the example in test/. First, install the serverify command globally:

sudo npm install -g serverify

Next, go into the test directory and run it:

cd test/
serverify

And that should start the server! You can navigate your browser to http://localhost:8080/index.html to view the test page.

Configuration

By default, serverify bundles up the file called index.js in the directory which it is run from and servers up static files contained in the ./www/ directory. The bundle is served at /bundle.js. You can configure this behavior using the following parameters:

  • entry: (Default: ./index.js) The entry point for the project.
  • www: (Default: ./www/) The static HTML directory
  • bundle: (Default: /bundle.js) The web path to serve up the bundled project on.
  • port: (Default: 8080) The port on which the server is hosted.

These parameters can be changed in one of the following ways:

  • You can override them via the command line, eg:

    serverify --entry test.js
    
  • You can create a file called .serverify in the same directory as your project which contains a JSON string describing the values for the parameters:

    echo "{port:9001}" > .serverify && serverify

Why not just run browserify --watch?

This only solves half the problem. You still need to launch a web server to host the files so that you can view them in your browser.

Why not use browserify-server?

browserify-server is a bit more substantial and offers some extra features, like autogenerated scaffolding, configurable Makefiles and the ability to bundle images and HTML. If you want this stuff, then by all means go use it. On the other hand, if you just want to run a server with browserify and nothing else, then serverify may be a better solution.

What about browservefy?

Because I only found out about browservefy recently. Though very similar to serverify, it has a few small differences:

  • browservefy is not carefully documented. (Though one could debate how important this is for such a trivial task)
  • It also creates a default index.html, which you may or may not want.
  • Also you can't specify the path for static HTML files, which again you may or may not care about.

Credits

(c) 2013 Mikola Lysenko. MIT License

Something went wrong with that request. Please try again.