Skip to content

Commit

Permalink
Add a named function for serverless middleware to make it more obviou…
Browse files Browse the repository at this point in the history
…s what’s happening in the dev server.

(cherry picked from commit 4fb89d3)
  • Loading branch information
zachleat committed Apr 15, 2022
1 parent 6b3db05 commit e2b121f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Plugins/ServerlessBundlerPlugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ class BundlerHelper {
);
deleteRequireCache(TemplatePath.absolutePath(serverlessFilepath));

return async (req, res, next) => {
return async function EleventyServerlessMiddleware(req, res, next) {
let serverlessFunction = require(serverlessFilepath);
let url = new URL(req.url, "http://localhost/"); // any domain will do here, we just want the searchParams
let queryParams = Object.fromEntries(url.searchParams);
Expand All @@ -257,7 +257,7 @@ class BundlerHelper {
this.eleventyConfig.logger.forceLog(
`Serverless (${this.name}): ${req.url} (${Date.now() - start}ms)`
);
};
}.bind(this);
}

async ensureDir() {
Expand Down

0 comments on commit e2b121f

Please sign in to comment.