Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

how express serve public folder

// projectDirectory/src/index.js
const path = require('path')
const publicDirectoryPath = path.join(__dirname, '../public')
app.use(express.static(publicDirectoryPath))

// projectDirectory/public -> create index.html
// localhost:3000/index.html -> Here you go..

Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #express #serve #public #folder
ADD COMMENT
Topic
Name
4+2 =