mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-12 00:27:21 +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("/")) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue