forked from Divij-Agarwal-42/duckmath.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.js
More file actions
20 lines (16 loc) · 664 Bytes
/
server.js
File metadata and controls
20 lines (16 loc) · 664 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// This is the file that the "start" script in package.json will execute.
// It sets up a basic web server.
const express = require('express');
const app = express();
// Cloud Run automatically sets the PORT environment variable.
// We must use this variable for the server to listen on the correct port.
const PORT = process.env.PORT || 8080;
app.get('/', (req, res) => {
// Respond to a GET request to the root path
const message = 'Hello from Cloud Run! Your Node.js app is running.';
console.log(`Sending response: ${message}`);
res.status(200).send(message);
});
app.listen(PORT, () => {
console.log(`Web server listening on port ${PORT}`);
});