Add CI & Deno Supported & Fix a lot of bugs & Webpack for building package

This commit is contained in:
2022-07-02 17:01:00 +00:00
committed by GitHub
parent b3552cb6a2
commit 057c9b9cb5
25 changed files with 2035 additions and 86 deletions

25
test/test-server.ts Normal file
View File

@ -0,0 +1,25 @@
import * as handlersJS from '../index';
const App = new handlersJS.rootRouter();
App.binding("/", App.create("GET", async () => "200 OK"));
App.binding("/post", App.create("POST", async (request: handlersJS.request<any>) => request.body));
App.binding("/header", App.create("GET", async () => {
const response = new handlersJS.response<any>("");
response.status = 204;
response.headers.set("itis", "work");
return response;
}));
App
.route("/info/(.*)")
.binding("/foo", App.create("GET", (): Promise<handlersJS.response<any>> => new Promise(resolve => {
throw new handlersJS.response("hit")
})))
.binding("/(.*)", App.create("GET", async (request: handlersJS.request<any>) => request.params[0] ?? "not found"));
App.useMappingAdapter();
export default App;