Experimental port to Firebase hosting

This commit is contained in:
Michael Jackson
2019-01-05 16:50:05 -08:00
parent e4d6df255e
commit 31e7d3865a
300 changed files with 129300 additions and 5817 deletions

View File

@ -1,4 +1,4 @@
const createSearch = require('../utils/createSearch');
import createSearch from '../utils/createSearch';
const knownQueryParams = {
main: true, // Deprecated, see #63
@ -23,12 +23,10 @@ function sanitizeQuery(originalQuery) {
/**
* Reject URLs with invalid query parameters to increase cache hit rates.
*/
function validateQuery(req, res, next) {
export default function validateQuery(req, res, next) {
if (!Object.keys(req.query).every(isKnownQueryParam)) {
return res.redirect(302, req.path + createSearch(sanitizeQuery(req.query)));
}
next();
}
module.exports = validateQuery;