Blame view

node_modules/jayson/examples/many_interfaces/server.js 560 Bytes
f7563de62   Palak Handa   first commit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
  var jayson = require(__dirname + '/../..');
  
  var server = jayson.server({
    add: function(a, b, callback) {
      return callback(null, a + b);
    }
  });
  
  // "http" will be an instance of require('http').Server
  var http = server.http();
  
  // "https" will be an instance of require('https').Server
  var https = server.https({
    //cert: require('fs').readFileSync('cert.pem'),
    //key require('fs').readFileSync('key.pem')
  });
  
  http.listen(80, function() {
    console.log('Listening on *:80')
  });
  
  https.listen(443, function() {
    console.log('Listening on *:443')
  });