server.js 656 B

1234567891011121314151617181920212223
  1. // server.js
  2. // where your node app starts
  3. // init project
  4. const express = require("express");
  5. const app = express();
  6. // we've started you off with Express,
  7. // but feel free to use whatever libs or frameworks you'd like through `package.json`.
  8. // http://expressjs.com/en/starter/static-files.html
  9. app.use(express.static("public"));
  10. // http://expressjs.com/en/starter/basic-routing.html
  11. app.get("/", function(request, response) {
  12. response.sendFile(__dirname + "/views/index.html");
  13. });
  14. // listen for requests :)
  15. const listener = app.listen(process.env.PORT, function() {
  16. console.log("Your app is listening on port " + listener.address().port);
  17. });