Skip to content

Commit

Permalink
added index.html file
Browse files Browse the repository at this point in the history
  • Loading branch information
JATIN-RAGHAV committed Jun 4, 2024
1 parent d27e3a3 commit 12a0b0c
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 4 deletions.
11 changes: 11 additions & 0 deletions server/dir/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
Hello World
</body>
</html>
4 changes: 2 additions & 2 deletions server/dir/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ const corsOptions = {
origin: 'https://jatin-raghav.vercel.app/', // Allow only this origin
optionsSuccessStatus: 200 // Some legacy browsers choke on 204
};
app.use((req, res, next) => {
res.json({ message: 'Hello World' });
app.use('/', (req, res, next) => {
res.sendFile('index.html', { root: __dirname });
});
app.use((0, cors_1.default)());
app.use(express_1.default.json());
Expand Down
11 changes: 11 additions & 0 deletions server/src/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
Hello World
</body>
</html>
4 changes: 2 additions & 2 deletions server/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ const corsOptions = {
optionsSuccessStatus: 200 // Some legacy browsers choke on 204
};

app.use((req, res, next) => {
res.json({message: 'Hello World'})
app.use('/',(req, res, next) => {
res.sendFile('index.html', {root: __dirname});
})
app.use(cors());
app.use(express.json());
Expand Down

0 comments on commit 12a0b0c

Please sign in to comment.