diff --git a/index.js b/index.js index 279f99b..be61d08 100644 --- a/index.js +++ b/index.js @@ -12,9 +12,12 @@ app.use(cors()); // Middleware to parse JSON app.use(express.json()); -// Route to get home +// Serve static files from the 'public' directory (where your index.html is located) +app.use(express.static(path.join(__dirname, 'public'))); + +// Route for serving index.html app.get('/', (req, res) => { - res.json("janco"); + res.sendFile(path.join(__dirname, 'public', 'index.html')); }); //Get news from NewsAPI diff --git a/index.html b/public/index.html similarity index 100% rename from index.html rename to public/index.html diff --git a/js/script.js b/public/script.js similarity index 100% rename from js/script.js rename to public/script.js