-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
38 lines (29 loc) · 1.09 KB
/
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
35
36
37
38
console.log("If modules not found, run `npm install` in /example folder!"); // git subtree push -P examples heroku master // OR // git subtree split -P examples master && git push heroku [['HASH']]:master --force
var port = process.env.OPENSHIFT_NODEJS_PORT || process.env.VCAP_APP_PORT || process.env.PORT || process.argv[2] || 8080;
var express = require('express');
var http = require('http');
var app = express();
var server = http.createServer(app);
var Gun = require('gun');
var gun = Gun({
file: 'data/app.json',
web: server
});
var riot = require('riot');
// var domvm = require("domvm");
// var Navigo = require('navigo');
// // navigo router init:
// var root = null;
// var useHash = true; // Defaults to: false
// var hash = '#!'; // Defaults to: '#'
// var router = new Navigo(root, useHash, hash);
//
// var thoughts = gun.get('thoughts');
//
// thoughts.map().on(function(thought, id) {
// console.log('thought:', thought, '(' + id + ')');
// });
app.use(Gun.serve);
app.use(express.static(__dirname));
server.listen(port);
console.log('Server started on port ' + port + ' with /gun');