Use ETag middleware

This commit is contained in:
D. Berge
2023-09-01 12:28:55 +02:00
parent c1ece08f38
commit b9e776ae74

View File

@@ -81,6 +81,9 @@ app.map({
app.use(mw.auth.authentify);
// Don't process the request if the data hasn't changed
app.use(mw.etag.ifNoneMatch);
// We must be authenticated before we can access these
app.map({
'/project': {
@@ -260,12 +263,12 @@ app.map({
},
'/queue/outgoing/': {
'asaqc': {
get: [ mw.queue.asaqc.get ],
get: [ mw.etag.noSave, mw.queue.asaqc.get ],
post: [ mw.auth.access.write, mw.queue.asaqc.post ],
'/project/:project': {
get: [ mw.queue.asaqc.get ],
get: [ mw.etag.noSave, mw.queue.asaqc.get ],
'/sequence/:sequence': {
get: [ mw.queue.asaqc.get ],
get: [ mw.etag.noSave, mw.queue.asaqc.get ],
}
},
'/:id': {
@@ -289,6 +292,10 @@ app.map({
//
});
app.use(mw.etag.save);
// Invalidate cache on database events
mw.etag.watch(app);
// Generic error handler. Stops stack dumps
// being sent to clients.
app.use(function (err, req, res, next) {