quakometer

git clone git://git.codymlewis.com/quakometer.git
Log | Files | Refs | LICENSE

app.js (472B)


      1 const app = require("express")();
      2 const server = require("http").Server(app);
      3 
      4 var port = normalizePort(process.env.PORT || '8080');
      5 
      6 console.log("Listening on *:" + port);
      7 server.listen(port);
      8 
      9 app.get("/", (req, res) => {
     10     res.sendFile(__dirname + "/index.html");
     11 });
     12 
     13 function normalizePort(val) {
     14   var port = parseInt(val, 10);
     15   if (isNaN(port)) {
     16     // named pipe
     17     return val;
     18   }
     19   if (port >= 0) {
     20     // port number
     21     return port;
     22   }
     23   return false;
     24 }