From 1ad8802192781dde074aa4b9529bd65c405ccc6f Mon Sep 17 00:00:00 2001 From: Benjamin Auder Date: Fri, 20 Mar 2020 00:14:08 +0100 Subject: [PATCH] Fix typo in server/README + increase interoperability following https://github.com/yagu0/vchess/pull/13 --- server/README.md | 2 +- server/routes/messages.js | 4 ++-- server/utils/database.js | 5 ++++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/server/README.md b/server/README.md index d896b014..ebcaf771 100644 --- a/server/README.md +++ b/server/README.md @@ -13,7 +13,7 @@ Instructions to run the server locally. ``` cd server/db -sqlite3 vchess.sqlite.db +sqlite3 vchess.sqlite sqlite> .read create.sql sqlite> .read populate.sql sqlite> .exit diff --git a/server/routes/messages.js b/server/routes/messages.js index 9355ff92..441abdb3 100644 --- a/server/routes/messages.js +++ b/server/routes/messages.js @@ -1,7 +1,7 @@ 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) => { diff --git a/server/utils/database.js b/server/utils/database.js index 7c20d521..b808257c 100644 --- a/server/utils/database.js +++ b/server/utils/database.js @@ -1,9 +1,12 @@ 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; -- 2.44.0