-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathtemp.ts
36 lines (25 loc) · 970 Bytes
/
temp.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import swaggerService = require("./lib/SwaggerService");
import http = require("http");
http.get("http://localhost:49250/swagger/docs/v1", (res) => {
res.setEncoding('utf-8');
var swaggerString = '';
res.on('data', (data) => {
console.log('Swagger json found!');
swaggerString += data;
});
res.on('end', () => {
// swagger object coming from server
var swaggerObject: Swagger.ISwagger = JSON.parse(swaggerString);
var opt: ISwaggerOptions = {
clientDestination: "app/API/BuilderAPI",
interfaceDestination: "app/API/Interfaces",
classDestination: "app/API/Model",
swaggerObject: swaggerObject
};
var swagSrv = new swaggerService(opt);
swagSrv.process();
console.log('Parse done!');
});
}).on('error', (e) => {
console.log('Error while gettings: ' + this.options.swaggerPath + ' - ' + e.message);
});;