use cors and better caching for assets
This commit is contained in:
parent
a7e9f7bee4
commit
996b596f96
1 changed files with 9 additions and 1 deletions
10
server.js
10
server.js
|
@ -47,7 +47,15 @@ async function getLanguages(owner, repo) {
|
||||||
return {}
|
return {}
|
||||||
}
|
}
|
||||||
|
|
||||||
app.use('/assets', express.static('assets'))
|
const assets = express.Router()
|
||||||
|
assets.use('/', (_, res, next) => {
|
||||||
|
res.set('Cache-Control', 'public, max-age=31536000')
|
||||||
|
res.set('Access-Control-Allow-Origin', '*')
|
||||||
|
next()
|
||||||
|
})
|
||||||
|
assets.use('/', express.static('assets'))
|
||||||
|
|
||||||
|
app.use('/assets', assets)
|
||||||
|
|
||||||
const defaultFormat = debug ? 'html' : 'png'
|
const defaultFormat = debug ? 'html' : 'png'
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue