Skip to content

Commit

Permalink
add support specific route extension to optimize performance
Browse files Browse the repository at this point in the history
  • Loading branch information
spksoft committed May 10, 2018
1 parent e7c1694 commit b40738a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,9 @@ export function route(path: string, method?: HttpMethod, ...middleware: Array<Mi
}

// 加载所有controller文件
export function load(controllersDir: string): Router {
export function load(controllersDir: string, extension?: string): Router {
getFiles(controllersDir).forEach((file) => {
if (file.endsWith('.js')) {
if (file.endsWith(extension || '.js')) {
require(file);
}
});
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"decorator",
"@route"
],
"version": "1.1.1",
"version": "1.2.1",
"scripts": {
"npm": "tsc"
},
Expand Down

0 comments on commit b40738a

Please sign in to comment.