-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathReadme
More file actions
47 lines (34 loc) · 1.25 KB
/
Readme
File metadata and controls
47 lines (34 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
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