Skip to content

Commit 97e7ed2

Browse files
Fix #24
1 parent 9c98137 commit 97e7ed2

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "typescript-rest",
3-
"version": "1.1.0",
3+
"version": "1.1.1",
44
"description": "A Library to create RESTFul APIs with Typescript",
55
"author": "Thiago da Rosa de Bustamante <thiago@cruxframework.org>",
66
"keywords": [

src/server.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,16 @@ export class Server {
2121
iternalServer.buildServices(types);
2222
}
2323

24+
/**
25+
* An alias for Server.loadServices()
26+
*/
27+
static loadControllers(router: express.Router, patterns: string | Array<string>, baseDir?: string) {
28+
Server.loadServices(router, patterns, baseDir);
29+
}
30+
31+
/**
32+
* Load all services from the files that matches the patterns provided
33+
*/
2434
static loadServices(router: express.Router, patterns: string | Array<string>, baseDir?: string) {
2535
const importedTypes: Array<Function> = [];
2636
const requireGlob = require('require-glob');

test/unit/test.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export function startApi(): Promise<void> {
2121
Server.setFileLimits({
2222
fieldSize: 1024 * 1024
2323
});
24-
Server.loadServices(app, ['test/data/*', '!**/*.yaml'], `${__dirname}/../..`);
24+
Server.loadControllers(app, ['test/data/*', '!**/*.yaml'], `${__dirname}/../..`);
2525
Server.setParamConverter((value, type) => {
2626
if (type.name === 'Person' && value['salary'] === 424242) {
2727
value['salary'] = 434343;

0 commit comments

Comments
 (0)