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..c2fa432 100644 --- a/requests/samples.http +++ b/requests/samples.http @@ -13,7 +13,6 @@ Content-Type: application/json { "context": "Are you alive?" } - ### Test Product Description Route POST http://localhost:3000/product-description Content-Type: application/json diff --git a/src/app.js b/src/app.js index 6c911a7..db87b37 100644 --- a/src/app.js +++ b/src/app.js @@ -1,5 +1,6 @@ const express = require("express"); // Import (Require) your routes here +const descriptionGen = require("./routes/descriptionGen"); const healthcheck = require("./routes/healthcheck"); const testingForInterns = require("./routes/testingForInterns"); @@ -10,5 +11,6 @@ app.use(express.json()); // Add your routes below app.use("/healthcheck", healthcheck); app.use("/testing-for-interns", testingForInterns); +app.use("/product-description", descriptionGen); module.exports = app; diff --git a/src/routes/descriptionGen.js b/src/routes/descriptionGen.js new file mode 100644 index 0000000..229c2b1 --- /dev/null +++ b/src/routes/descriptionGen.js @@ -0,0 +1,11 @@ +const express = require("express"); +const createOpenAIMiddleware = require("../middleware/openaiMiddleware"); + +const router = express.Router(); + +const hardcodedPrompt = + "You are a product developer. Generate a brief description of the products materials, dimensions, features, and target market."; + +router.post("/", createOpenAIMiddleware(hardcodedPrompt)); + +module.exports = router;