Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sant123/connect
Powerful and extensible router for Deno with std/http in mind
https://github.com/sant123/connect
connect http-server middleware route routing
Last synced: about 1 month ago
JSON representation
Powerful and extensible router for Deno with std/http in mind
- Host: GitHub
- URL: https://github.com/sant123/connect
- Owner: sant123
- License: mit
- Created: 2022-07-05T16:37:33.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2022-07-29T23:34:58.000Z (over 2 years ago)
- Last Synced: 2024-09-17T15:28:17.118Z (about 2 months ago)
- Topics: connect, http-server, middleware, route, routing
- Language: TypeScript
- Homepage:
- Size: 5.86 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Connect
Powerful and extensible router for Deno with std/http in mind``` ts
import { serve } from "https://deno.land/[email protected]/http/server.ts";
import { Connect } from "https://deno.land/x/connect/mod.ts";const app = new Connect();
app.handleNotFound = () => {
return new Response("The page you are looking for is not here :)", {
status: 404,
});
};app.get("/", () => {
return new Response("Hello world!");
});app.map({
"/contact": () => {
return new Response("Hello from contact page!");
},
});app.route("/shop")
.get(() => {
return new Response("Hello from shop page!");
});serve(app.handler, { port: 8080 });
```