From ee666f6e084ba1d132e509248661511aa75163bc Mon Sep 17 00:00:00 2001 From: Arthur Lu Date: Thu, 14 Dec 2023 00:25:08 +0000 Subject: [PATCH] add prototypes of api routes --- src/main.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/main.js b/src/main.js index 94dcffa..c97dd78 100644 --- a/src/main.js +++ b/src/main.js @@ -1,6 +1,7 @@ import express from "express"; import bodyParser from "body-parser"; import cookieParser from "cookie-parser"; +import cors from "cors"; import morgan from "morgan"; import LDAP from "./ldap.js"; @@ -22,3 +23,22 @@ global.package = _package(global.argv.package); global.config = _config(global.argv.configPath); const ldap = new LDAP(global.argv.ldapURL, global.config.basedn); + +const app = express(); +app.use(bodyParser.urlencoded({ extended: true })); +app.use(cookieParser()); +app.use(cors({ origin: global.db.hostname })); +app.use(morgan("combined")); + +// endpoint handles both adding a new user and updating an existing user including password and groups +app.post("/users/:userid", (req, res) => {}); + +app.get("/users/:userid", (req, res) => {}); + +app.delete("/users/:userid", (req, res) => {}); + +app.post("/groups/:groupid", (req, res) => {}); + +app.get("/groups/:groupid", (req, res) => {}); + +app.delete("/groups/:groupid", (req, res) => {}); \ No newline at end of file