forked from sentientwaffle/zag-standalone
-
Notifications
You must be signed in to change notification settings - Fork 2
/
server.js
34 lines (31 loc) · 922 Bytes
/
server.js
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
var zWeb = require('zag');
var daemon = require('zag-daemon');
var PostgresBackend = require('zag-backend-pg');
var db = "postgres://postgres:1234@localhost/postgres";
var daemonHosts = "127.0.0.1:8876";
var daemons = [daemonHosts];
var webHost = "0.0.0.0:8080"
daemon(
{ host: daemonHosts
, join: daemons
, db: db
, env: "prod"
, backend: require('zag-backend-pg')
}
).on("error", function(err) {
console.error('daemon error', err);
});
zWeb(
{ host: webHost
, db: db
, env: "prod"
, daemons: daemons
, backend: PostgresBackend
// This directory needs to be readable and writable by the process.
, public: "/tmp/metrics-standalone-public"
}).on("error", function(err) {
console.error('web error', err);
}).on("ready", function() {
console.log("zag-web listening on " + webHost)
console.log("zag-daemon pool: " + JSON.stringify(daemons))
});