Allow `onRequest` callbacks to access build-time file content
Open
Nobody has claimed this yet.
enhancement
needs-votes
- Dominant language
- JavaScript
- Stars
- 109
- Forks
- 20
- Avg merge
- 1m
- Merged PRs (30d)
- 1
Description
Related to #29.
This is what works now:
const { EleventyServerlessBundlerPlugin } = require("@11ty/eleventy");
module.exports = function(eleventyConfig) {
eleventyConfig.setServerOptions({
middleware: [function overrideMiddleware(req, res, next) {
// This works now
res.writeHead(200, {"content-type": "text/html"}); // content-type header required for live-reload
res.write("Before Text");
res.end();
next();
}],
});
});
However, I’d like to see folks able to consume res.statusCode (404 when no file is present) and res.body with the static content to do request-time content transforms
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing how onRequest callbacks and the middleware shown in the issue receive the request and response. Check the behavior for an existing file and a missing file, then verify that callbacks can read static content through res.body and distinguish missing files through res.statusCode (404).
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100