Skip to content

Commit c41b157

Browse files
authored
Merge pull request #1 from fac29b/master
merge
2 parents cf64dae + fcf61c7 commit c41b157

1 file changed

Lines changed: 10 additions & 12 deletions

File tree

server.js

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
const express = require("express");
2+
const path = require('path');
23
var nodemailer = require("nodemailer");
34
require("dotenv").config();
45
const { OpenAI } = require("openai");
@@ -47,22 +48,22 @@ app.get("/email", async (req, res) => {
4748
});
4849
});
4950

50-
51-
5251
app.get("/openai", async (req, res) => {
53-
54-
const {recipe_country_of_origin, is_lactose_intolerant, is_vegan, what_are_user_other_dietary_requirements } = req.query
52+
const {
53+
recipe_country_of_origin,
54+
is_lactose_intolerant,
55+
is_vegan,
56+
what_are_user_other_dietary_requirements,
57+
} = req.query;
5558
try {
5659
console.log(
5760
{ recipe_country_of_origin },
5861
{ is_lactose_intolerant },
5962
{ is_vegan },
60-
{what_are_user_other_dietary_requirements}
63+
{ what_are_user_other_dietary_requirements }
6164
);
6265

63-
const prompt = `Provide a recipe for a dish from ${
64-
recipe_country_of_origin
65-
}, taking into account the fact that I'm ${
66+
const prompt = `Provide a recipe for a dish from ${recipe_country_of_origin}, taking into account the fact that I'm ${
6667
is_lactose_intolerant === "true"
6768
? "lactose intolerant"
6869
: "not lactose intolerant"
@@ -105,15 +106,12 @@ app.get("/openai", async (req, res) => {
105106
// const dishCountry = req.body.recipe_country_of_origin;
106107
// const isUserLactoseIntolerant = req.body.is_lactose_intolerant;
107108

108-
109109
// res.json({
110110
// message: `Variables ${dishCountry} and ${isUserLactoseIntolerant} received successfully`,
111111
// });
112112
// });
113113

114-
115-
116-
app.use(express.static("public"));
114+
app.use(express.static(path.join(__dirname, "public")));
117115
const port = process.env.PORT || 3000;
118116
app.listen(port, () => {
119117
console.log(`Server running on port ${port}`);

0 commit comments

Comments
 (0)