mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-23 20:33:09 +02:00
Refactor
This commit is contained in:
parent
88f736fa9b
commit
abe8127840
2 changed files with 19 additions and 13 deletions
18
src/web/about/index.ts
Normal file
18
src/web/about/index.ts
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
import * as express from 'express';
|
||||||
|
import ms = require('ms');
|
||||||
|
|
||||||
|
const router = express.Router();
|
||||||
|
|
||||||
|
router.use('/@/about/resources', express.static(`${__dirname}/resources`, {
|
||||||
|
maxAge: ms('7 days')
|
||||||
|
}));
|
||||||
|
|
||||||
|
router.get('/@/about/', (req, res) => {
|
||||||
|
res.sendFile(`${__dirname}/pages/index.html`);
|
||||||
|
});
|
||||||
|
|
||||||
|
router.get('/@/about/:page(*)', (req, res) => {
|
||||||
|
res.sendFile(`${__dirname}/pages/${req.params.page}.html`);
|
||||||
|
});
|
||||||
|
|
||||||
|
module.exports = router;
|
|
@ -62,19 +62,7 @@ app.use(subdomain({
|
||||||
/**
|
/**
|
||||||
* Routing
|
* Routing
|
||||||
*/
|
*/
|
||||||
|
app.use(require('./about')); // about docs
|
||||||
app.use('/@/about/resources', express.static(`${__dirname}/about/resources`, {
|
|
||||||
maxAge: ms('7 days')
|
|
||||||
}));
|
|
||||||
|
|
||||||
app.get('/@/about/', (req, res) => {
|
|
||||||
res.sendFile(`${__dirname}/about/pages/index.html`);
|
|
||||||
});
|
|
||||||
|
|
||||||
app.get('/@/about/:page(*)', (req, res) => {
|
|
||||||
res.sendFile(`${__dirname}/about/pages/${req.params.page}.html`);
|
|
||||||
});
|
|
||||||
|
|
||||||
app.get('/@/auth/*', serveApp('auth')); // authorize form
|
app.get('/@/auth/*', serveApp('auth')); // authorize form
|
||||||
app.get('/@/dev/*', serveApp('dev')); // developer center
|
app.get('/@/dev/*', serveApp('dev')); // developer center
|
||||||
app.get('*', serveApp('client')); // client
|
app.get('*', serveApp('client')); // client
|
||||||
|
|
Loading…
Reference in a new issue