Skip to content

Setup Basic Express Server – Code Snippet

Express is an excellent Node JS framework for web backend. It’s Fast, unopinionated, and minimalist. See the basic setup of the express server in the following example.

const express = require('express')

const app = express()

// Home Route
app.get('/', (req, res) => {
    res.send('Hello from express...')
})

// Port
const PORT = 5000 || process.env.PORT

app.listen(PORT, () => console.log(`Server running on port ${PORT}`))
Published inCode Snippets

Comments are closed.