Skip to content

lucacasonato/deno-fetchevent

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Deno FetchEvent

deno doc

This project is a prototype of what a FetchEvent based http server would feel like. For more background, take a look at https://github.com/denoland/deno/issues/4898.

DISCLAIMER: This is not tested at all. Please do not use this for anything important. This is just a prototype and will not be developed further.

Example

import { serve } from "https://raw.githubusercontent.com/lucacasonato/deno-fetchevent/master/mod.ts";

console.log("Listening on http://localhost:8080/");
for await (const event of serve(":8080")) {
  const { request } = event;

  console.log("---");
  console.log(request.url);
  console.log(request.method);
  if (request.body) console.log(await request.json());

  event.respondWith(Response.redirect("https://deno.land", 303));
}

Quick start:

deno run --allow-net https://raw.githubusercontent.com/lucacasonato/deno-fetchevent/master/example.ts

About

FetchEvent based server compatible with browser.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published