Browse Source

ready ecosystem

master
jefry 3 years ago
parent
commit
0175276c29
4 changed files with 59 additions and 0 deletions
  1. +16
    -0
      ecosystem.config.js
  2. +1
    -0
      package.json
  3. +37
    -0
      server.js
  4. +5
    -0
      yarn.lock

+ 16
- 0
ecosystem.config.js View File

@@ -0,0 +1,16 @@
const path = require("path");
require("dotenv").config({ path: path.join(__dirname, ".env") });
module.exports = {
apps: [
{
name: "tbg-hotel-web",
script: "server.js",
time: true,
env: {
NODE_ENV: "development",
},
env_production: process.env,
},
],
};

+ 1
- 0
package.json View File

@@ -12,6 +12,7 @@
"dependencies": {
"animate.css": "^4.1.1",
"axios": "^0.21.1",
"dotenv": "^10.0.0",
"next": "^10.0.7",
"nodemailer": "^6.5.0",
"nodemailer-sendgrid-transport": "^0.2.0",


+ 37
- 0
server.js View File

@@ -0,0 +1,37 @@
const { createServer } = require("http");
const { parse } = require("url");
const next = require("next");
const cli = require("next/dist/cli/next-start");
const dev = process.env.NODE_ENV !== "production";
const app = next({ dev });
const handle = app.getRequestHandler();
// require("dotenv").config();
console.log(process.env.PORT);
const port = process.env.PORT || "14009";
app.prepare().then(() => {
createServer((req, res) => {
const parsedUrl = parse(req.url, true);
const { pathname, query } = parsedUrl;
// if (pathname === "/") {
// app.render(req, res, "/home", query);
// } else if (pathname === "/yamaha") {
// app.render(req, res, "/yamaha/home", query);
// } else if (pathname === "/suzuki") {
// app.render(req, res, "/suzuki/home", query);
// }
// app.render(req, res, "/BookingService", query);
// } else if (pathname === "/statuspengajuan/") {
// app.render(req, res, "/StatusPengajuan", query);
// }
// else {
handle(req, res, parsedUrl);
// }
}).listen(port, (err) => {
if (err) throw err;
console.log(`Ready on port ${port}`);
});
});
// cli.nextStart(["-p", port]);

+ 5
- 0
yarn.lock View File

@@ -1164,6 +1164,11 @@ domutils@^1.5.1:
dom-serializer "0"
domelementtype "1"

dotenv@^10.0.0:
version "10.0.0"
resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-10.0.0.tgz#3d4227b8fb95f81096cdd2b66653fb2c7085ba81"
integrity sha512-rlBi9d8jpv9Sf1klPjNfFAuWDjKLwTIJJ/VxtoTwIR6hnZxcEOQCZg2oIL3MWBYw5GpUDKOEnND7LXTbIpQ03Q==

ecc-jsbn@~0.1.1:
version "0.1.2"
resolved "https://registry.yarnpkg.com/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz#3a83a904e54353287874c564b7549386849a98c9"


Loading…
Cancel
Save