File tree Expand file tree Collapse file tree 1 file changed +11
-7
lines changed Expand file tree Collapse file tree 1 file changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -6,13 +6,7 @@ const fs = require('fs');
66const endpointsFile = 'endpoints.yaml' ;
77const resultFile = 'app.js' ;
88
9- console . log ( 'Read' , endpointsFile ) ;
10-
11- try {
12-
13- const content = fs . readFileSync ( endpointsFile , 'utf8' ) ;
14- const config = yaml . safeLoad ( content ) ;
15- //console.debug(config);
9+ const createEndpoints = ( config ) => {
1610 console . log ( 'Generate' , resultFile ) ;
1711 for ( let endpoint of config ) {
1812 console . log ( 'GET' , endpoint . path , '=>' , endpoint . get ) ;
3226 })\n` . replace ( / ^ / gm, '' ) ;
3327
3428 fs . writeFileSync ( resultFile , resultedCode ) ;
29+ } ;
30+
31+ console . log ( 'Read' , endpointsFile ) ;
32+
33+ try {
34+
35+ const content = fs . readFileSync ( endpointsFile , 'utf8' ) ;
36+ const config = yaml . safeLoad ( content ) ;
37+ //console.debug(config);
38+ createEndpoints ( config ) ;
3539
3640} catch ( ex ) {
3741 console . error ( 'Failed to parse' , endpointsFile ) ;
You can’t perform that action at this time.
0 commit comments