“Cara Mengirim File Statis di Express” Kode Jawaban

File statis server Node Express

var express = require('express');
var app = express();
var path = require('path');

//app.use(express.static(__dirname)); // Current directory is root
app.use(express.static(path.join(__dirname, 'public'))); //  "public" off of current is root

app.listen(80);
console.log('Listening on port 80');
JDog

Cara Mengirim File Statis di Express

app.use('/', express.static(__dirname));
rohit sekh

Mengekspresikan file statis JS

app.use(express.static('public'))
Tired Termite

Gunakan statis dengan ekspres

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

Jawaban yang mirip dengan “Cara Mengirim File Statis di Express”

Pertanyaan yang mirip dengan “Cara Mengirim File Statis di Express”

Lebih banyak jawaban terkait untuk “Cara Mengirim File Statis di Express” di JavaScript

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya