You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Right now, there are no customization options for customizing server code other than creating middleware. Customizing layout, CSS styles, and authentication is pretty well defined.
Allow customization of server code without modifying the base code so we can receive updates from the main New York Times repository. (Without is taken loosely, if hooks need to be created somehow, maybe there is no way around it)
Additional Information
Need a solution to change response output before sending the payload back to the client. Right now, there are hooks for preload (before the server code is called) and postload (which is called after the payload is sent). Postload here doesn't really help since the response has already been sent.
The text was updated successfully, but these errors were encountered:
'use strict'
const router = require('express-promise-router')()
async function addFileType(req, res, next) {
if (req.path === '/search') {
const format = res.format
res.format = function (body) {
// Override original function here and
// modify payload output
}
}
next()
}
router.use(addFileType)
exports.preload = route
Personally, I think neither of these solutions are ideal. A better way would be some how override the actual handlePage() function inside the file /server/routes/pages.js without modifying original.
We still need to figure out a better method of customizing server code without copying the entire file over to the custom folder. Please add ideas here.
Problem Description
Right now, there are no customization options for customizing server code other than creating middleware. Customizing layout, CSS styles, and authentication is pretty well defined.
https://github.com/adhocteam/nytimes-library/blob/main/custom/README.md
Feature
Allow customization of server code without modifying the base code so we can receive updates from the main New York Times repository. (Without is taken loosely, if hooks need to be created somehow, maybe there is no way around it)
Additional Information
Need a solution to change response output before sending the payload back to the client. Right now, there are hooks for
preload
(before the server code is called) andpostload
(which is called after the payload is sent). Postload here doesn't really help since the response has already been sent.The text was updated successfully, but these errors were encountered: