diff options
author | LarsVomMars | 2020-09-30 20:37:16 +0200 |
---|---|---|
committer | LarsVomMars | 2020-09-30 20:37:16 +0200 |
commit | ad024d82b42216f38f81e2b2f40a23c79e6c9e5c (patch) | |
tree | e683987e43a0a1d271081cbeabe44357b52b445e /quotes/index.js | |
parent | 187657c3b425839c52e93bd5604f71c583ceff91 (diff) |
One project one server
Diffstat (limited to 'quotes/index.js')
-rw-r--r-- | quotes/index.js | 33 |
1 files changed, 3 insertions, 30 deletions
diff --git a/quotes/index.js b/quotes/index.js index e4d56e9..e90dd80 100644 --- a/quotes/index.js +++ b/quotes/index.js @@ -1,28 +1,6 @@ -require("dotenv").config(); const express = require("express"); -const mariadb = require("mariadb"); -const app = express(); -const pool = mariadb.createPool({ - host: process.env.DB_HOST, - user: process.env.DB_USER, - password: process.env.DB_PWD, - database: process.env.DB_NAME, -}); - -let db_conn; - -pool.getConnection() - .then((conn) => { - db_conn = conn; - db_conn.release(); - }) - .catch((err) => { - console.error(err); - db_conn = null; - }); - -app.use(express.urlencoded({ extended: true })); -app.use(express.json()); +const db = require("../db"); +const app = express.Router(); app.use("/", express.static(__dirname + "/public")); @@ -30,9 +8,4 @@ app.get("/api/list", (req, res) => { res.send("ok\n"); }); -app.on("close", () => { - console.log("CLOSE"); -}); - -console.log("Listening on port 5007"); -app.listen(5007); +module.exports = app; |