Use express.static directly
This commit is contained in:
parent
dfe2f29fe0
commit
091e13b46a
|
@ -16,7 +16,6 @@ import findEntry from './middleware/findEntry.js';
|
|||
import noQuery from './middleware/noQuery.js';
|
||||
import redirectLegacyURLs from './middleware/redirectLegacyURLs.js';
|
||||
import requestLog from './middleware/requestLog.js';
|
||||
import staticFiles from './middleware/staticFiles.js';
|
||||
import validateFilename from './middleware/validateFilename.js';
|
||||
import validatePackageURL from './middleware/validatePackageURL.js';
|
||||
import validatePackageName from './middleware/validatePackageName.js';
|
||||
|
@ -39,7 +38,7 @@ export default function createServer() {
|
|||
}
|
||||
|
||||
app.use(cors());
|
||||
app.use(staticFiles);
|
||||
app.use(express.static('public', { maxAge: '1y' }));
|
||||
|
||||
// Special startup request from App Engine
|
||||
// https://cloud.google.com/appengine/docs/standard/nodejs/how-instances-are-managed
|
||||
|
|
|
@ -1,12 +0,0 @@
|
|||
import express from 'express';
|
||||
|
||||
const staticMiddleware = express.static('public', { maxAge: '1y' });
|
||||
|
||||
export default function staticFiles(req, res, next) {
|
||||
if (req.query.meta != null) {
|
||||
// Let ?meta requests fall through.
|
||||
return next();
|
||||
}
|
||||
|
||||
staticMiddleware(req, res, next);
|
||||
}
|
Loading…
Reference in New Issue