satyarohith / sift

Sift is a routing and utility library for Deno Deploy.
https://deno.land/x/sift
MIT License
170 stars 14 forks source link

404 error on importing sift #52

Closed arnu515 closed 2 years ago

arnu515 commented 2 years ago

Importing the latest version of sift and running deno cache gives this error:

$ deno cache index.ts
Download https://raw.githubusercontent.com/usesift/media_types/34656bf398c81f2687fa5010e56844dac4e7a2e9/mod.ts
error: Import 'https://raw.githubusercontent.com/usesift/media_types/34656bf398c81f2687fa5010e56844dac4e7a2e9/mod.ts' failed: 404 Not Found

The fix would be to bump media_types from 2.10 to 2.11.1.

I've created a pull request for you, so you can just merge it.

Thanks

arnu515 commented 2 years ago

@satyarohith can you create a new release?

Thanks.

satyarohith commented 2 years ago

@arnu515, this version uses the official version of media_types and it works.

import { serve } from "https://deno.land/x/sift@0.4.2/mod.ts";

serve({
  "/": () => new Response("hello world"),
  "/blog/:slug": (request, params) => {
    const post = `Hello, you visited ${params.slug}!`;
    return new Response(post);
  },
  // The route handler of 404 will be invoked when a route handler
  // for the requested path is not found.
  404: () => new Response("not found"),
});
arnu515 commented 2 years ago

@satyarohith it works now. It didn't work earlier for me, and I had to manually bump the version of media_types by cloning the source code of sift.

Here's the bugged Repl, if you could have a look.

Thanks.