Sync with new config

This commit is contained in:
Moe Poi ~ 2022-04-07 12:19:11 +07:00
parent 8b39669b62
commit dca1b0cd3a
3 changed files with 13 additions and 5 deletions

View file

@ -8,7 +8,7 @@ try {
process.exit(0); process.exit(0);
} }
const HOST = config.host + "/api"; const HOST = config.url + "/api";
function getProducts() { function getProducts() {
return axios return axios

View file

@ -8,6 +8,14 @@ const app = express();
const indexRouter = require('./routes/index'); const indexRouter = require('./routes/index');
const api = require('./routes/api'); const api = require('./routes/api');
let config;
try {
config = require("./config");
} catch (e) {
console.log("No config file found");
process.exit(0);
}
app.use(express.static("public")); app.use(express.static("public"));
app.set("view engine", "ejs"); app.set("view engine", "ejs");
@ -30,7 +38,7 @@ app.use(function (req, res, next) {
next(); next();
}); });
app.listen("9286", () => { app.listen(config.port, () => {
console.log("Server is running on port : 9286"); console.log(`Server is running on port : ${config.port}`);
}); });
module.exports = app; module.exports = app;

View file

@ -108,7 +108,7 @@ router.post("/register", async (req, res) => {
var token = randtoken.generate(20); var token = randtoken.generate(20);
if (result[0].verify == 0) { if (result[0].verify == 0) {
let subject = "Account Verification - Nekoya"; let subject = "Account Verification - Nekoya";
let content = `<p>Hello!!! Please click this link <a href="${config.host}/verify-mail?token=${token}">link</a> to verify your account!!! Thanks!!!</p>`; let content = `<p>Hello!!! Please click this link <a href="${config.url}/verify-mail?token=${token}">link</a> to verify your account!!! Thanks!!!</p>`;
var sent = mail.send( var sent = mail.send(
req.body.email, req.body.email,
subject, subject,
@ -481,7 +481,7 @@ router.post("/request-reset-password", async (req, res) => {
}); });
} else { } else {
let subject = "Reset Password - Nekoya"; let subject = "Reset Password - Nekoya";
let content = `<p>Hello!!! Please click this link <a href="${config.host}/reset-password?token=${response[0].token}">link</a> to reset your account password!!! Thanks!!!</p>`; let content = `<p>Hello!!! Please click this link <a href="${config.url}/reset-password?token=${response[0].token}">link</a> to reset your account password!!! Thanks!!!</p>`;
var sent = mail.send( var sent = mail.send(
req.body.email, req.body.email,
subject, subject,