Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
10 changes: 4 additions & 6 deletions app/backend/index.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
// backend/index.js
import { prompt } from "./prompts.mjs";
import cors from "cors";
const express = require('express');
import express from "express";

const app = express();
const PORT = 5000;

app.use(cors());
app.use(express.json());


app.post("/api/prompt", async (req, res) => {
const { text, tone } = req.body;A

const { text, tone } = req.body;
try {
const result = await prompt(text, tone);
res.json({ result });
Expand All @@ -22,5 +21,4 @@ app.post("/api/prompt", async (req, res) => {

app.listen(PORT, () => {
console.log(`Server running on http://localhost:${PORT}`);
});

});
2 changes: 1 addition & 1 deletion app/backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"keywords": [],
"author": "",
"license": "ISC",
"type": "commonjs",
"type": "module",
"dependencies": {
"cors": "^2.8.5",
"dotenv": "^17.2.0",
Expand Down