-.-
This commit is contained in:
		
							
								
								
									
										49
									
								
								types/index.d.ts
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										49
									
								
								types/index.d.ts
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,49 @@
 | 
			
		||||
import { Handler } from "../src/types.d.js";
 | 
			
		||||
 | 
			
		||||
declare class Flummpress {
 | 
			
		||||
  constructor();
 | 
			
		||||
  router: Router;
 | 
			
		||||
  tpl: Template;
 | 
			
		||||
  middleware: Handler[];
 | 
			
		||||
 | 
			
		||||
  use(plugin: Router | Template | Handler): this;
 | 
			
		||||
  listen(...args: any[]): this;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
declare class Router {
 | 
			
		||||
  importRoutesFromPath(p: string, tpl?: Template | false): Promise<this>;
 | 
			
		||||
  group(basePath: string | RegExp, callback: (methods: {
 | 
			
		||||
    get: (path: string | RegExp, ...handlers: Handler[]) => void;
 | 
			
		||||
    post: (path: string | RegExp, ...handlers: Handler[]) => void;
 | 
			
		||||
    put: (path: string | RegExp, ...handlers: Handler[]) => void;
 | 
			
		||||
    delete: (path: string | RegExp, ...handlers: Handler[]) => void;
 | 
			
		||||
    patch: (path: string | RegExp, ...handlers: Handler[]) => void;
 | 
			
		||||
  }) => void): this;
 | 
			
		||||
 | 
			
		||||
  use(obj: Router | Template): void;
 | 
			
		||||
 | 
			
		||||
  get(path: string | RegExp, ...handlers: Handler[]): this;
 | 
			
		||||
  post(path: string | RegExp, ...handlers: Handler[]): this;
 | 
			
		||||
  head(path: string | RegExp, ...handlers: Handler[]): this;
 | 
			
		||||
  put(path: string | RegExp, ...handlers: Handler[]): this;
 | 
			
		||||
  delete(path: string | RegExp, ...handlers: Handler[]): this;
 | 
			
		||||
  patch(path: string | RegExp, ...handlers: Handler[]): this;
 | 
			
		||||
 | 
			
		||||
  static(options: { dir?: string; route?: RegExp }): this;
 | 
			
		||||
 | 
			
		||||
  getRoute(path: string, method: string): { path: string | RegExp; methods: { [method: string]: Handler[] } } | undefined;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
declare class Template {
 | 
			
		||||
  setDebug(debug: boolean): void;
 | 
			
		||||
  setViews(views: string): void;
 | 
			
		||||
  setGlobals(globals: Record<string, any>): void;
 | 
			
		||||
  setCache(cache: boolean): void;
 | 
			
		||||
 | 
			
		||||
  render(file: string, data?: Record<string, any>, locals?: Record<string, any>): string;
 | 
			
		||||
  escape(str: string): string;
 | 
			
		||||
  getMtime(file: string): number;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export { Flummpress, Router, Template };
 | 
			
		||||
export default Flummpress;
 | 
			
		||||
		Reference in New Issue
	
	Block a user