1
- declare type ScanPaths = ( path : string , currentLevel : string ) => Promise < Array < RoutePath > >
2
- declare type ValidateRoute = ( routepath : RoutePath ) => Promise < Route > | never ;
1
+ export declare type ScanPaths = ( path : string , currentLevel : string ) => Promise < Array < RoutePath > >
2
+ export declare type ValidateRoute = ( routepath : RoutePath ) => Promise < Route > | never ;
3
3
4
4
declare type RequestMethod = "GET" | "POST" | "PUT" | "DELETE" | "OPTIONS" | "HEAD" | "PATCH" ;
5
5
6
- declare class BuxtRequest {
7
- constructor ( baseRequest : Request ) ;
6
+ export declare class BuxtRequest {
7
+ constructor ( baseRequest : Request , paramData : Route | null ) ;
8
8
9
9
request : Request ;
10
10
method : string ;
11
11
path : string ;
12
12
matchPath : string ;
13
+ folderPath : string ;
13
14
14
15
query : { [ key : string ] : string } ;
15
16
headers : { [ key : string ] : string } ;
16
17
params : { [ key : string ] : string } ;
18
+ rotueParams : { [ key : string ] : string } ;
17
19
18
20
body : any ;
19
21
blob : any ;
@@ -44,10 +46,11 @@ export declare class BuxtServer {
44
46
routes : string [ ] ;
45
47
port : number ;
46
48
baseAddress : string ;
49
+ routeRoot : string ;
47
50
48
- private constructor ( port : number ) ;
51
+ private constructor ( port : number , routeRoot : string ) ;
49
52
50
- static createServer ( ) : Promise < BuxtServer > ;
53
+ static createServer ( port : number , routeRoot : string ) : Promise < BuxtServer > ;
51
54
52
55
private registerRoutes ( ) : Promise < void > ;
53
56
private handleRequest ( ) : Promise < Response > | Response ;
@@ -63,6 +66,12 @@ export declare type RoutePath = {
63
66
64
67
export declare type Route = {
65
68
route : string ,
66
- parameters : string [ ] ,
69
+ routeParameters : RouteParameters ,
67
70
delegate : ( req : BuxtRequest , res : BuxtResponse ) => Promise < BuxtResponse > ;
68
- }
71
+ }
72
+
73
+ export declare type RouteParameters = {
74
+ [ key : string ] : string
75
+ }
76
+
77
+ export default function ( port : number ) : Promise < BuxtServer > ;
0 commit comments