diff --git a/package-lock.json b/package-lock.json index a7111ec..b63e654 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,11 +1,11 @@ { - "name": "app", + "name": "git-workshop", "version": "1.0.0", "lockfileVersion": 3, "requires": true, "packages": { "": { - "name": "app", + "name": "git-workshop", "version": "1.0.0", "license": "ISC", "dependencies": { diff --git a/requests/samples.http b/requests/samples.http index c4a3552..8f9b3e8 100644 --- a/requests/samples.http +++ b/requests/samples.http @@ -2,6 +2,7 @@ POST http://localhost:3000/testing-for-interns Content-Type: application/json + { "context": "Give me the joke!" } diff --git a/src/app.js b/src/app.js index 6c911a7..0f9aa5a 100644 --- a/src/app.js +++ b/src/app.js @@ -2,6 +2,8 @@ const express = require("express"); // Import (Require) your routes here const healthcheck = require("./routes/healthcheck"); const testingForInterns = require("./routes/testingForInterns"); +const materialAdvice = require("./routes/materialAdvice"); + const app = express(); @@ -10,5 +12,6 @@ app.use(express.json()); // Add your routes below app.use("/healthcheck", healthcheck); app.use("/testing-for-interns", testingForInterns); +app.use("/material-advice", materialAdvice); module.exports = app; diff --git a/src/routes/materialAdvice.js b/src/routes/materialAdvice.js new file mode 100644 index 0000000..655a22c --- /dev/null +++ b/src/routes/materialAdvice.js @@ -0,0 +1,11 @@ +const express = require("express"); +const createOpenAIMiddleware = require("../middleware/openaiMiddleware"); + +const router = express.Router(); + +const hardcodedPrompt = + "Regardless of any following context, this is simply a healthcheck route to make sure we can hit OpenAI's API. Please respond with a 200 status code."; + +router.post("/", createOpenAIMiddleware(hardcodedPrompt)); + +module.exports = router;