Go Pro Sign Up Login

Buy Now and unlock this series

$

49

.99

yours forever

Become a Pro and unlock everything

$

24

.99

per month

VSCode Setup

For those running Deno in VSCode, we will need to download the official Deno package and update our settings to get rid of some errors that we are currently seeing.

Downloads

Become a pro to download code and videos

Comments

User avatar

Aaron

about 1 year ago

Kinda wondering if they changed the API since this tutorial was created. I'm getting this error:

error: TS2554 [ERROR]: Expected 2-3 arguments, but got 1. const s = serve({ port: 7777 }); ~~~~~~~~~~~~~~~~~~~~~ at ...

An argument for 'handler' was not provided.
  handler: Handler,
  ~~~~~~~~~~~~~~~~
    at ...

TS2504 [ERROR]: Type 'Promise' must have a 'Symbol.asyncIterator' method that returns an async iterator. for await (const req of s) { ^ at ...

TS2773 [ERROR]: Did you forget to use 'await'? for await (const req of s) { ^ at ... Found 2 errors.

But I was able to get it running with an example from the Deno Docs:

import { listenAndServe } from "https://deno.land/std@0.109.0/http/server.ts";

listenAndServe(":7777", () => new Response("Hello World \n"));

console.log("http://localhost:7777/");

Want to join the conversation?

Become a Pro member today!