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(deno): replace deprecated Deno server module with Deno.serve #5886

Merged
merged 1 commit into from
Feb 24, 2024
Merged

fix(deno): replace deprecated Deno server module with Deno.serve #5886

merged 1 commit into from
Feb 24, 2024

Conversation

reosablo
Copy link
Contributor

Overview

What is it?

  • Feature / enhancement
  • Bug
  • Docs / tests / types / typos

Description

This pull request updates the codebase to use the recommended Deno.serve API for creating HTTP servers, replacing the deprecated serve function from the Deno standard library.

// Before:
import { serve } from "https://deno.land/std@0.192.0/http/server.ts";
serve(/* ... */);

// After:
Deno.serve(/* ... */);

You can find the Deno.serve signature here.

I also replace the docs URL for Deno servers. The former redirects to the latter.

- https://deno.com/manual/examples/http_server
+ https://docs.deno.com/runtime/tutorials/http_server

Use cases and why

The latest serve docs says this is deprecated.

Deprecated
(will be removed after 1.0.0) Use Deno.serve instead.

Deno.serve is available since Deno 1.35 released on July 2023.

The long awaited new web server API, Deno.serve(), is now stable. It offers a much easier API while significantly enhancing performance.

Checklist:

  • My code follows the developer guidelines of this project
  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • Added new tests to cover the fix / functionality

Copy link

netlify bot commented Feb 24, 2024

👷 Deploy request for qwik-insights pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit b9385cd

@reosablo
Copy link
Contributor Author

The console outputs unavailable URL http://localhost:3009/app/ (404 Resource Not Found).
This doesn't seem to be a regression bug.

$ npm run serve

> serve
> deno run --allow-net --allow-read --allow-env server/entry.deno.js

Server starter: http://localhost:3009/app/
Listening on http://localhost:3009/

Copy link
Member

@gioboa gioboa left a comment

Choose a reason for hiding this comment

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

That's amazing @reosablo you rock
We really appreciate your help ☺️❤️

@gioboa gioboa enabled auto-merge (squash) February 24, 2024 08:13
@gioboa gioboa merged commit cc7cd70 into QwikDev:main Feb 24, 2024
21 checks passed
@reosablo reosablo deleted the fix-deno-serve branch February 24, 2024 08:40
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.

None yet

2 participants