Skip to content

Commit

Permalink
Update index.js to startup index.html
Browse files Browse the repository at this point in the history
Move documents to a public folder for reference
  • Loading branch information
JancoEngelbrecht committed Sep 14, 2024
1 parent 3fbf7f6 commit 214e385
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
File renamed without changes.
File renamed without changes.

0 comments on commit 214e385

Please sign in to comment.