Created
December 11, 2023 01:05
-
-
Save smashdevcode/c9e78c5e0173535c985226bed749e849 to your computer and use it in GitHub Desktop.
Express Starter App
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const express = require('express'); | |
// Call the `express` function to create the Express application. | |
const app = express(); | |
// Define a GET route for the path `/`. | |
app.get('/', (req, res) => { | |
// Return a JSON formatted response. | |
res.json({ message: 'Hello world!' }); | |
}); | |
const port = 8081; | |
// Start the app listening on the provided port. | |
// The callback function will be called once the server has been started. | |
app.listen(port, () => console.log(`Listening at http://localhost:${port}...`)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment