chanded api names

This commit is contained in:
Jelaletdin12
2026-03-27 23:01:33 +05:00
parent 7dc9a5fbc7
commit 7c75205077
5 changed files with 10 additions and 3637 deletions

View File

@@ -3,11 +3,11 @@ import fs from "fs";
import path from "path";
const app = express();
const port = 3000;
const port = 4173;
// API endpointleri
app.post("/api/data", express.json(), (req, res) => {
fs.writeFile(path.join(process.cwd(), "public", "data.json"), JSON.stringify(req.body, null, 2), (err) => {
app.post("/frontend-api/data", express.json(), (req, res) => {
fs.writeFile(path.join(process.cwd(), "dist", "data.json"), JSON.stringify(req.body, null, 2), (err) => {
if (err) {
res.status(500).send(err.message);
} else {
@@ -16,8 +16,8 @@ app.post("/api/data", express.json(), (req, res) => {
});
});
app.get("/api/data", (req, res) => {
fs.readFile(path.join(process.cwd(), "public", "data.json"), "utf-8", (err, data) => {
app.get("/frontend-api/data", (req, res) => {
fs.readFile(path.join(process.cwd(), "dist", "data.json"), "utf-8", (err, data) => {
if (err) {
res.status(500).send(err.message);
} else {