This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app.post("/plan", function(req, res) { | |
let occasion = req.body.occasion; | |
let pax = req.body.pax; | |
let budget = req.body.budget; | |
let theme = req.body.theme; | |
let country = req.body.theme | |
const prompt = `Teach me how to plan for ${occasion}, for ${pax} people. I have a budget of ${budget} dollars. My theme is ${theme}. I am in ${country}.` | |
callOpenAI(prompt).then(response => { | |
console.log("Response", response) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async function callOpenAI(prompt) { | |
const url = 'https://api.openai.com/v1/chat/completions'; | |
const headers = { | |
'Authorization': `Bearer ${process.env.OpenAIToken}`, | |
'Content-Type': 'application/json' | |
}; | |
const data = { | |
'model': 'gpt-3.5-turbo', | |
'messages': [ | |
{"role": "system", "content": "You are a helpful assistant."}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const express = require('express'); | |
const bodyParser = require('body-parser'); | |
const app = express(); | |
const port = process.env.PORT || 3000; | |
app.use(bodyParser.json()); // for parsing application/json | |
app.use(bodyParser.urlencoded({ extended: true })); // for parsing application/x-www-form-urlencoded | |
app.get('/', (req, res) => { | |
res.send('Hello, World!'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"strings" | |
) | |
type FullName struct { | |
firstName string | |
lastName string |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
) | |
func NameFunc(nameChannel chan string, name string) { | |
finalName := "Name: " + name | |
nameChannel <- finalName | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"time" | |
) | |
func myFunc() { | |
fmt.Println("Reine") | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
func myFunc() { | |
fmt.Println("Reine") | |
} | |
func main() { | |
fmt.Println("Hello") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
html { | |
font-family: sans-serif; | |
} | |
body { | |
display: flex; | |
justify-content: center; | |
align-items: center; | |
height: 100vh; | |
} | |
.confettiButton { |
NewerOlder