Frontik on NodeJS
JavaScript
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
tests
.gitignore
Readme
config.js.ex

Readme

IMPORTANT deep alpha, everything can be changed.

To use FrontikJS you need NodeJS 0.4.0 or above.
http://nodejs.org/

Install NodeJS, then checkout FrontikJS.
Copy config.js.ex to config.js and change port if you need.
> node lib/frontik.js
> curl "localhost:8080"
8080 if you don't change port in config file.
You should see "Hello world" html page.

If you want to run tests you need npm
http://npmjs.org/

And vows
http://vowsjs.org/



-----------------------------------------------

See test app to create your own application.
If you have several apps, write config.apps function.

Simple application

module.exports = function (handler, callback){
    callback({
        collect: function(callback){
            // some logic
            // must call callback() when ready;
        },
        transform: function(doc){
            // make response
            handler.response.writeHead(200, {'Content-Type': 'text/html; charset=utf-8'});
            handler.response.write('<!DOCTYPE html><head><html><title>FrontikJS</title></head><body>Hello!</body></html>');
            handler.response.end();
        }
    });
};

handler.http(url, [options], [callback]);

handler.file(path, [callback]);

handler.put(name, promise); // promise – handler.http || handler.file