Sharathhebbar24 commited on
Commit
e9e1a47
·
verified ·
1 Parent(s): 41a4d53

Update main.js

Browse files
Files changed (1) hide show
  1. main.js +11 -18
main.js CHANGED
@@ -1,18 +1,11 @@
1
- const express = require('express');
2
- const path = require('path');
3
-
4
- const app = express();
5
- const PORT = 3000;
6
-
7
- // Serve static files from the 'public' directory
8
- app.use(express.static(path.join(__dirname, 'public')));
9
-
10
- // Define API endpoints
11
- app.get('/api/message', (req, res) => {
12
- res.json({ message: 'Hello from the backend!' });
13
- });
14
-
15
- // Start the server
16
- app.listen(PORT, () => {
17
- console.log(`Server is running on http://localhost:${PORT}`);
18
- });
 
1
+ const express = require('express'),
2
+ app = express();
3
+
4
+ app.use(express.urlencoded({ extended: true }))
5
+ app.use(express.json())
6
+
7
+ app.get('/',
8
+ (req, res) => res.send('Dockerizing Node Application'))
9
+
10
+ app.listen(5000,
11
+ () => console.log(`[bootup]: Server is running at port: 5000`));