Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ext/http): registerDeclarativeServer #26606

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open

Conversation

ricfrst
Copy link

@ricfrst ricfrst commented Oct 28, 2024

Changes to registerDeclarativeServer as discussed over our call

@CLAassistant
Copy link

CLAassistant commented Oct 28, 2024

CLA assistant check
All committers have signed the CLA.

Added test case for registerDeclarativeServer  like we discussed over email
test of registerdeclarativeserver changes
@@ -882,7 +882,7 @@ function registerDeclarativeServer(exports) {
: "";
const host = formatHostName(hostname);

// deno-lint-ignore no-console
// Log server information
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You will need to keep the previous lint supression here

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment is still relevant and the CI won't pass unless it's addressed

Copy link
Member

@bartlomieju bartlomieju left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! You'll also need to update cli/tsc/dts/lib.deno.ns.d.ts and the ServeDefaultExport to include new onListen property that has the same signature as you can find in ServeOptions interface

Comment on lines 1 to 3
export const fetch = (req: Request) => {
return new Response("Hello from declarative server!");
};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't support this syntax (yet!), so you'll need something like this:

export default {
  fetch(req: Request) {
    return new Response("Hello from declarative server");
  },
  onListen(info) {
    console.log(info);
  }
} satisfies Deno.ServeDefaultExport;

ricfrst and others added 4 commits October 30, 2024 13:54
Comment on lines 1211 to 1212
/** Interface for serving HTTP requests. */
interface ServeDefaultExport {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like we got two ServeDefaultExport now :D can you please move onListen declaration to the existing interface on line 5068?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will do, working on it ASAP

Copy link
Member

@bartlomieju bartlomieju left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good 👍 just make sure to run tools/format.js to make CI pass.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants