From b603b358ad0b06ff3632285bb96a2046f534c895 Mon Sep 17 00:00:00 2001 From: LordFarquaadtheCreator Date: Mon, 5 Aug 2024 16:06:18 -0400 Subject: [PATCH] updating readme --- README.md | 9 ++++++++- middlewares/authorize.ts | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index d89a9cb..42ad859 100644 --- a/README.md +++ b/README.md @@ -7,8 +7,12 @@ Server is built with Node.js and Express. Provides endpoints for managing a coll ## How to use Creating, Reading and Updating can be done from the database (default approach) endpoints. Only reading can be done for the local JSON file. -## Endpoints for DB +## AUTH +In order to `POST` or `PUT` data to the database, you must provide **Basic Auth**. *Only system admins and active developers have access to this.* +- Username is your name (case doesn't matter) +- Password is your API Key provided +## Endpoints for DB ### Get projects `/projects/get` @@ -23,6 +27,9 @@ Filters are stackable, meaning you can do something similar to: `/projects/get?team=John&cohort=1&team=Jane` This will return all projects that have John **AND** Jane in their team and are in cohort 1. You can stack as many filters as you want but be aware that the more filters you add, the more specific the query will be, meaning it might return no results. +*Tip:* To get all projects leave `get` as blank + + ### Post new projects `/projects/add` diff --git a/middlewares/authorize.ts b/middlewares/authorize.ts index 54fc5fd..3d2f3ab 100644 --- a/middlewares/authorize.ts +++ b/middlewares/authorize.ts @@ -31,6 +31,7 @@ const authorize = function () { if (result.rows.length === 0) { return res.status(401).json({ message: "Invalid name or key!" }); } + next(); } catch (e: any) {