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.

37 lines
1.1 KiB

  1. const { createServer } = require("http");
  2. const { parse } = require("url");
  3. const next = require("next");
  4. const cli = require("next/dist/cli/next-start");
  5. const dev = process.env.NODE_ENV !== "production";
  6. const app = next({ dev });
  7. const handle = app.getRequestHandler();
  8. // require("dotenv").config();
  9. const port = process.env.PORT || "14009";
  10. app.prepare().then(() => {
  11. createServer((req, res) => {
  12. const parsedUrl = parse(req.url, true);
  13. const { pathname, query } = parsedUrl;
  14. // if (pathname === "/") {
  15. // app.render(req, res, "/home", query);
  16. // } else if (pathname === "/yamaha") {
  17. // app.render(req, res, "/yamaha/home", query);
  18. // } else if (pathname === "/suzuki") {
  19. // app.render(req, res, "/suzuki/home", query);
  20. // }
  21. // app.render(req, res, "/BookingService", query);
  22. // } else if (pathname === "/statuspengajuan/") {
  23. // app.render(req, res, "/StatusPengajuan", query);
  24. // }
  25. // else {
  26. handle(req, res, parsedUrl);
  27. // }
  28. }).listen(port, (err) => {
  29. if (err) throw err;
  30. console.log(`Ready on port ${port}`);
  31. });
  32. });
  33. // cli.nextStart(["-p", port]);