add prototypes of api routes

This commit is contained in:
Arthur Lu 2023-12-14 00:25:08 +00:00
parent 87a42299e6
commit ee666f6e08

View File

@ -1,6 +1,7 @@
import express from "express"; import express from "express";
import bodyParser from "body-parser"; import bodyParser from "body-parser";
import cookieParser from "cookie-parser"; import cookieParser from "cookie-parser";
import cors from "cors";
import morgan from "morgan"; import morgan from "morgan";
import LDAP from "./ldap.js"; import LDAP from "./ldap.js";
@ -22,3 +23,22 @@ global.package = _package(global.argv.package);
global.config = _config(global.argv.configPath); global.config = _config(global.argv.configPath);
const ldap = new LDAP(global.argv.ldapURL, global.config.basedn); 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) => {});