1
0
mirror of https://github.com/tcgdex/cards-database.git synced 2025-04-22 19:02:10 +00:00

fix: Cache saving 5xx errors

Signed-off-by: Avior <github@avior.me>
This commit is contained in:
Florian Bouillon 2024-01-22 23:22:39 +01:00
parent 41bf9afde7
commit 0146765e7a
3 changed files with 3 additions and 3 deletions

View File

@ -1,7 +1,7 @@
meta { meta {
name: 474 - Queries crashing the server name: 474 - Queries crashing the server
type: http type: http
seq: 2 seq: 4
} }
get { get {

View File

@ -1,7 +1,7 @@
meta { meta {
name: 475 - Ability to query subfileds name: 475 - Ability to query subfileds
type: http type: http
seq: 4 seq: 5
} }
get { get {

View File

@ -31,7 +31,7 @@ const endpointToField: Record<string, keyof SDKCard> = {
server server
// Midleware that handle caching only in production and on GET requests // Midleware that handle caching only in production and on GET requests
.use(apicache.middleware('1 day', (req: Request) => process.env.NODE_ENV === 'production' && req.method === 'GET', {})) .use(apicache.middleware('1 day', (req: Request, res: Response) => res.status < 400 && process.env.NODE_ENV === 'production' && req.method === 'GET', {}))
// .get('/cache/performance', (req, res) => { // .get('/cache/performance', (req, res) => {
// res.json(apicache.getPerformance()) // res.json(apicache.getPerformance())