Affiliate link

Express.js - static middleware

The static middleware allows you to serve static resources in express application.

Static resources can be audio/image/video files, CSS files, client-side JavaScript files, and many others.

Get started with Express

npm init

npm install express

Bootstrap Express

Download

Express - Example

const express = require('express')
const app = express()
const port = 3000

app.get('/', (req, res) => {
    res.send('Hello World! LearnCodeNow')
})

app.listen(port, () => {
    console.log(`Example app listening on port ${port}`)
})
Advertisment
StudioPress
Ad - Managed WordPress Hosting by SiteGround - Powerful, yet simple to use. Amazing speed, tools and support. Click for more.