From 9d9f44702c9cbc5db820d1ba1e8502124ff967f1 Mon Sep 17 00:00:00 2001 From: devvsakib Date: Sat, 27 Jul 2024 19:52:28 +0600 Subject: [PATCH] revert changes --- api/index.js | 23 ----------------------- vercel.json | 16 ++++++---------- 2 files changed, 6 insertions(+), 33 deletions(-) delete mode 100644 api/index.js diff --git a/api/index.js b/api/index.js deleted file mode 100644 index 4950405..0000000 --- a/api/index.js +++ /dev/null @@ -1,23 +0,0 @@ -const express = require('express'); -const fs = require('fs'); -const path = require('path'); -const app = express(); -const port = process.env.PORT || 3000; - -app.use(express.static(path.join(__dirname, 'public'))); - -// Route to get the JSON data -app.get('/posts/index.json', (req, res) => { - fs.readFile(path.join(__dirname, 'public', 'posts', 'index.json'), 'utf8', (err, data) => { - if (err) { - res.status(500).send('Server Error'); - return; - } - res.header("Content-Type", "application/json"); - res.send(data); - }); -}); - -app.listen(port, () => { - console.log(`Server running on port ${port}`); -}); diff --git a/vercel.json b/vercel.json index e2b4f0d..2c6e202 100644 --- a/vercel.json +++ b/vercel.json @@ -1,12 +1,8 @@ { - "version": 2, - "builds": [ - { "src": "api/index.js", "use": "@vercel/node" }, - { "src": "public/**/*", "use": "@vercel/static" } - ], - "routes": [ - { "src": "/api/(.*)", "dest": "/api/index.js" }, - { "src": "/(.*)", "dest": "/public/$1" } + "rewrites": [ + { + "source": "/(.*)", + "destination": "/" + } ] - } - \ No newline at end of file +}