Skip to content

Allow onRequest callbacks to access build-time file content #30

@zachleat

Description

@zachleat

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestneeds-votesA feature request on the backlog that needs upvotes or downvotes. Remove this label when resolved.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions