Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

serve a file in express

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

app.use(express.static(__dirname + '/dist'))

app.get('/', (_, res) => {
    res.sendFile('index.html')
})

app.listen(3000)
Source by localhost #
 
PREVIOUS NEXT
Tagged: #serve #file #express
ADD COMMENT
Topic
Name
3+4 =