“Express JS serve html” Respostas de código

Express serve html

const path = require('path')
const express = require('express')

const app = express()

const port = process.env.PORT || 3000
const publicDirectoryPath = path.join(__dirname, '../public')

app.use(express.static(publicDirectoryPath))

app.listen(port, () => {
    console.log(`Server is up on port ${port}!`)
})
Thor

App.Use público

app.use(express.static('public'))
app.use(express.static('files'))
Testy Tamarin

Use estático com expres

app.use(express.static('directoryName'))
#store the files in the directory as if you were making a website without express
Encouraging Elk

Express JS serve html

const express = require('express')

const app = express()
app.use(express.static('public'))

app.listen(port, () => {
    console.log(`Server is up on port ${port}!`)
})
SamuraiR4cc00n

Respostas semelhantes a “Express JS serve html”

Perguntas semelhantes a “Express JS serve html”

Mais respostas relacionadas para “Express JS serve html” em JavaScript

Procure respostas de código populares por idioma

Procurar outros idiomas de código