Fix typo in server/README + increase interoperability following https://github.com...
authorBenjamin Auder <benjamin.auder@somewhere>
Thu, 19 Mar 2020 23:14:08 +0000 (00:14 +0100)
committerBenjamin Auder <benjamin.auder@somewhere>
Thu, 19 Mar 2020 23:14:08 +0000 (00:14 +0100)
server/README.md
server/routes/messages.js
server/utils/database.js

index d896b01..ebcaf77 100644 (file)
@@ -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
index 9355ff9..441abdb 100644 (file)
@@ -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) => {
index 7c20d52..b808257 100644 (file)
@@ -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;