Explorar o código

fix common imports, db file path

Craig Fletcher %!s(int64=4) %!d(string=hai) anos
pai
achega
e3277174e1
Modificáronse 3 ficheiros con 5 adicións e 2545 borrados
  1. 3 3
      modules/server.js
  2. 1 2542
      package-lock.json
  3. 1 0
      package.json

+ 3 - 3
modules/server.js

@@ -1,9 +1,9 @@
 import restify from "restify";
 import loadDb from "./db.js";
 import corsMiddleware from "cors";
-import errors from "../../common/errors";
+import {errors} from "common";
 
-const db = loadDb("ti.db");
+const db = loadDb("/data/ti.db");
 
 const server = restify.createServer({
   name: "spoll",
@@ -66,7 +66,7 @@ server.post("/user/:name", function(req, res, next) {
     if (userEntry) {
       if (req.body && userEntry.password === req.body.password) {
         const voteEntry = db.get(`/votes/${req.params.name}`) || [];
-        res.send({ factions: voteEntry });
+        res.send({ ...voteEntry });
       } else {
         res.send({ error: errors.user.badpassword });
       }

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 1 - 2542
package-lock.json


+ 1 - 0
package.json

@@ -13,6 +13,7 @@
     "@babel/core": "^7.13.10",
     "@babel/preset-env": "^7.13.10",
     "@babel/register": "^7.13.8",
+    "common": "git+https://git.lpapi.io/leakypixel/spoll-common",
     "cors": "^2.8.5",
     "esm": "^3.2.25",
     "node-json-db": "^1.3.0",

Algúns arquivos non se mostraron porque demasiados arquivos cambiaron neste cambio