let router = require("express").Router();
const access = require("../utils/access");
-const sendEmail = require(__dirname.replace("/routes", "/utils/mailer"));
-const params = require(__dirname.replace("/routes", "/config/parameters"));
+const sendEmail = require("../utils/mailer");
+const params = require("../config/parameters");
// Send a message through contact form
router.post("/messages", access.ajax, (req,res) => {
const sqlite3 = require('sqlite3');
+const path = require('path');
const params = require("../config/parameters")
if (params.env == "development") sqlite3.verbose();
-const DbPath = __dirname.replace("/utils", "/db/vchess.sqlite");
+const DbPath = __dirname.replace(
+ `${path.sep}utils`,
+ `${path.sep}db${path.sep}vchess.sqlite`);
const db = new sqlite3.Database(DbPath);
module.exports = db;