mirror of
https://github.com/facebook/docusaurus.git
synced 2025-04-30 02:37:59 +02:00
Update server routing
This commit is contained in:
parent
a56c7a6755
commit
a455ca9745
2 changed files with 7 additions and 3 deletions
|
@ -140,6 +140,7 @@ function execute(port) {
|
||||||
file = CWD + "/../" + file;
|
file = CWD + "/../" + file;
|
||||||
if (!fs.existsSync(file)) {
|
if (!fs.existsSync(file)) {
|
||||||
next();
|
next();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
console.log(file);
|
console.log(file);
|
||||||
const result = readMetadata.processMetadata(file);
|
const result = readMetadata.processMetadata(file);
|
||||||
|
@ -253,7 +254,7 @@ function execute(port) {
|
||||||
});
|
});
|
||||||
|
|
||||||
/* handle all other main pages */
|
/* handle all other main pages */
|
||||||
app.get("*.html", (req, res) => {
|
app.get("*.html", (req, res, next) => {
|
||||||
purgeCache(CWD + "/siteConfig.js");
|
purgeCache(CWD + "/siteConfig.js");
|
||||||
siteConfig = require(CWD + "/siteConfig.js");
|
siteConfig = require(CWD + "/siteConfig.js");
|
||||||
|
|
||||||
|
@ -337,7 +338,8 @@ function execute(port) {
|
||||||
res.send(str);
|
res.send(str);
|
||||||
} else {
|
} else {
|
||||||
console.log(req.path);
|
console.log(req.path);
|
||||||
res.send("No file found");
|
next();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -377,6 +379,8 @@ function execute(port) {
|
||||||
/* serve static content first from user folder then from docusaurus */
|
/* serve static content first from user folder then from docusaurus */
|
||||||
app.use(siteConfig.baseUrl, express.static(CWD + "/static"));
|
app.use(siteConfig.baseUrl, express.static(CWD + "/static"));
|
||||||
app.use(siteConfig.baseUrl, express.static(__dirname + "/../static"));
|
app.use(siteConfig.baseUrl, express.static(__dirname + "/../static"));
|
||||||
|
app.use(express.static(CWD + "/static"));
|
||||||
|
app.use(express.static(__dirname + "/../static"));
|
||||||
|
|
||||||
app.get(/\/[^\.]*\/?$/, (req, res) => {
|
app.get(/\/[^\.]*\/?$/, (req, res) => {
|
||||||
if (req.path.toString().endsWith("/")) {
|
if (req.path.toString().endsWith("/")) {
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
"shelljs": "^0.7.8"
|
"shelljs": "^0.7.8"
|
||||||
},
|
},
|
||||||
"name": "docusaurus",
|
"name": "docusaurus",
|
||||||
"version": "1.0.0-alpha.19",
|
"version": "1.0.0-alpha.20",
|
||||||
"bin": {
|
"bin": {
|
||||||
"docusaurus-start": "./lib/start-server.js",
|
"docusaurus-start": "./lib/start-server.js",
|
||||||
"docusaurus-build": "./lib/build-files.js",
|
"docusaurus-build": "./lib/build-files.js",
|
||||||
|
|
Loading…
Add table
Reference in a new issue