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:
parent
41bf9afde7
commit
0146765e7a
@ -1,7 +1,7 @@
|
||||
meta {
|
||||
name: 474 - Queries crashing the server
|
||||
type: http
|
||||
seq: 2
|
||||
seq: 4
|
||||
}
|
||||
|
||||
get {
|
||||
|
@ -1,7 +1,7 @@
|
||||
meta {
|
||||
name: 475 - Ability to query subfileds
|
||||
type: http
|
||||
seq: 4
|
||||
seq: 5
|
||||
}
|
||||
|
||||
get {
|
||||
|
@ -31,7 +31,7 @@ const endpointToField: Record<string, keyof SDKCard> = {
|
||||
|
||||
server
|
||||
// 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) => {
|
||||
// res.json(apicache.getPerformance())
|
||||
|
Loading…
x
Reference in New Issue
Block a user