mirror of
https://github.com/facebook/docusaurus.git
synced 2025-04-29 10:17:55 +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;
|
||||
if (!fs.existsSync(file)) {
|
||||
next();
|
||||
return;
|
||||
}
|
||||
console.log(file);
|
||||
const result = readMetadata.processMetadata(file);
|
||||
|
@ -253,7 +254,7 @@ function execute(port) {
|
|||
});
|
||||
|
||||
/* handle all other main pages */
|
||||
app.get("*.html", (req, res) => {
|
||||
app.get("*.html", (req, res, next) => {
|
||||
purgeCache(CWD + "/siteConfig.js");
|
||||
siteConfig = require(CWD + "/siteConfig.js");
|
||||
|
||||
|
@ -337,7 +338,8 @@ function execute(port) {
|
|||
res.send(str);
|
||||
} else {
|
||||
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 */
|
||||
app.use(siteConfig.baseUrl, express.static(CWD + "/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) => {
|
||||
if (req.path.toString().endsWith("/")) {
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
"shelljs": "^0.7.8"
|
||||
},
|
||||
"name": "docusaurus",
|
||||
"version": "1.0.0-alpha.19",
|
||||
"version": "1.0.0-alpha.20",
|
||||
"bin": {
|
||||
"docusaurus-start": "./lib/start-server.js",
|
||||
"docusaurus-build": "./lib/build-files.js",
|
||||
|
|
Loading…
Add table
Reference in a new issue