Jeff Mesnil
Weblog · Dev · Photos · Books

⇨ JSApp.US: a node.js Hosting Provider

November 27, 2010

I was looking for a provider to host the HTML5 / node.js Web application that I am blogging about here and there and JSApp.US is the first one that I found.

It is straightforward to use and I have deployed my Web application on it. You can try it by yourself on your iPhone or iPad by going to http://board.jsapp.us/.

At first, it complained that __dirname was not defined when server.js is trying to read files based on the URL path. I modified server.js to remove the leading / from the path and it works fine:

    // won't work on JSApp.us
    fs.readFile(__dirname + path, function(err, data) {
       ...
    }
    // but this works
    fs.readFile(path.substring(1, path.length), function(err, data) {
       ...
    }

The offline support does not work: somehow this provider does not return the Content-Type HTTP header set by server.js. Since the cache manifest is not served with the expected text/cache-manifest, I suppose that Safari does not take it into account and bypass the offline configuration.

update: I was wrong the cache.manifest file is returned with the correct Content-Type:

$ curl -Gi http://board.jsapp.us/cache.manifest
HTTP/1.1 200 OK
Server: nginx/0.8.53
Date: Sat, 27 Nov 2010 00:06:45 GMT
Content-Type: text/cache-manifest
Transfer-Encoding: chunked
Connection: keep-alive

CACHE MANIFEST
# 2010-11-27

CACHE:
/screen.css
/client.js
/jquery.min.js

I don't know why offline support is not working... The rest of the application seems to work fine though.

It will make the next version of the application more interesting. I want to add Web Sockets support to display the pieces of the other users on the Web application (in addition to its own piece). With this hosting provider, I'll be able to release a version that everyone will be able to try.

As an aside, it uses SkyWriter (né Bespin) to edit the code and the integration is pretty slick.