-
Notifications
You must be signed in to change notification settings - Fork 47
Expand file tree
/
Copy pathserver.js
More file actions
61 lines (54 loc) · 1.22 KB
/
server.js
File metadata and controls
61 lines (54 loc) · 1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
// Serve files from the app directory
server: {
baseDir: "app"
}
// Serve files from the app directory with directory listing
server: {
baseDir: "app",
directory: true
}
// Multiple base directories
server: {
baseDir: ["app", "dist"]
}
// Serve files from the app directory, with a specific index filename
server: {
baseDir: "app",
index: "index.htm"
}
// Serve files from the app directory, with custom file extension fallbacks
server: {
baseDir: "app",
extensions: ["html","json"]
}
// Since version 1.2.1
// The key is the url to match
// The value is which folder to serve (relative to your current working directory)
server: {
baseDir: "app",
routes: {
"/bower_components": "bower_components"
}
}
// Custom Middleware
server: {
baseDir: "./",
middleware: function (req, res, next) {
console.log("Hi from middleware");
next();
}
}
// Multiple custom Middlewares
server: {
baseDir: "./",
middleware: [
function (req, res, next) {
console.log("Hi from first middleware");
next();
},
function (req, res, next) {
console.log("Hi from the second middleware");
next();
}
]
}