-
-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fixed some missing types in 5.0.0 * router matchup fixed? * moved folder * CHANGELOG * ts-ignore added back in * released v5.0.2 - types fix in rotuer
- Loading branch information
Showing
30 changed files
with
64 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { AutoRouter } from 'AutoRouter' | ||
import { IttyRouter } from 'IttyRouter' | ||
import { Router } from 'Router' | ||
import { IRequest } from 'types' | ||
|
||
// setup | ||
type FooResponse = { foo: string } | ||
const request = new Request('https://foo.bar') | ||
|
||
// test | ||
const autorouter = AutoRouter<IRequest, [], FooResponse>() | ||
const router = Router<IRequest, [], FooResponse>() | ||
const ittyrouter = IttyRouter<IRequest, [], FooResponse>() | ||
|
||
// test getters | ||
autorouter.get('/throw', (a) => a.b.c) | ||
router.get('/throw', (a) => a.b.c) | ||
ittyrouter.get('/throw', (a) => a.b.c) | ||
|
||
// autorouter tests | ||
autorouter.missing | ||
autorouter.format | ||
|
||
// test response formatting | ||
const autorouterResponse = (await autorouter.fetch(request)).foo | ||
const routerResponse = (await router.fetch(request)).foo | ||
const ittyrouterResponse = (await ittyrouter.fetch(request)).foo | ||
|
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { IRequest } from './IRequest' | ||
import { RequestHandler } from './RequestHandler' | ||
import { ResponseHandler } from './ResponseHandler' | ||
import { RouterType } from './RouterType' | ||
|
||
export type AutoRouterType< | ||
R = IRequest, | ||
Args extends any[] = any[], | ||
ResponseType = any | ||
> = { | ||
missing?: RequestHandler | ||
format?: ResponseHandler | ||
} & RouterType<R, Args, ResponseType> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters