not really known
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

44 lines
881 B

  1. /** express app */
  2. const express = require("express");
  3. /**session data for login */
  4. const session = require('express-session');
  5. /** used to parse the request URL */
  6. const url = require('url');
  7. const app = express();
  8. const fs = require('fs');
  9. app.use(express.urlencoded());
  10. app.use(express.json()); // if needed
  11. /**Initializes sessions for login */
  12. app.use(session({ secret: "changeWithConfigLater", cookie: { maxAge: 6000000 }}));
  13. const PORT = 5000;
  14. const whiskers = require('whiskers');
  15. function fetchHTML(templateContext, templateKey, filename)
  16. {
  17. templateContext[templateKey] = fs.readFileSync(filename)
  18. }
  19. app.get('/', (requst, result) =>
  20. {
  21. result.write(fs.readFileSync("./html/home.html"));
  22. result.end();
  23. });
  24. app.use(express.static('css'));
  25. app.use(express.static('js'));
  26. app.listen(PORT, () => console.log(`App listening on port ${PORT}!`));