Public API for a society manager application

index.js 846B

1234567891011121314151617181920212223242526272829
  1. var express = require('express');
  2. var https = require('https');
  3. var app = express();
  4. var route_manager = require("./route-manager.js");
  5. var bodyParser = require('body-parser');
  6. var fs = require('fs');
  7. var prkey = fs.readFileSync('server.key');
  8. var certi = fs.readFileSync('server.crt');
  9. app.use(bodyParser.json()); // for parsing application/json
  10. app.use(bodyParser.urlencoded({ extended: true })); // for parsing application/x-www-form-urlencoded
  11. app.use('/', route_manager);
  12. // app.listen(3000, function () {
  13. // console.log('Example app listening on port 3000!');
  14. // });
  15. https.createServer({
  16. key: prkey,
  17. cert: certi
  18. }, app).listen(3000, function() {
  19. console.log("App listening for HTTPS connections on port 3000!");
  20. });
  21. process.on('SIGINT', function() {
  22. console.log( "\nRecieved Ctrl-C, shutting down." );
  23. process.exit(0);
  24. })