File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -316,6 +316,7 @@ var AngularFullstackGenerator = yeoman.generators.Base.extend({
316316
317317 saveSettings : function ( ) {
318318 if ( this . skipConfig ) return ;
319+ this . config . set ( 'endpointDirectory' , 'server/api/' ) ;
319320 this . config . set ( 'insertRoutes' , true ) ;
320321 this . config . set ( 'registerRoutesFile' , 'server/routes.js' ) ;
321322 this . config . set ( 'routesNeedle' , '// Insert routes below' ) ;
Original file line number Diff line number Diff line change @@ -7,6 +7,11 @@ var ScriptBase = require('../script-base.js');
77
88var Generator = module . exports = function Generator ( ) {
99 ScriptBase . apply ( this , arguments ) ;
10+
11+ this . option ( 'endpointDirectory' , {
12+ desc : 'Parent directory for enpoints' ,
13+ type : String
14+ } ) ;
1015} ;
1116
1217util . inherits ( Generator , ScriptBase ) ;
@@ -66,10 +71,14 @@ Generator.prototype.prompting = function askFor() {
6671 } . bind ( this ) ) ;
6772} ;
6873
74+ Generator . prototype . configuring = function config ( ) {
75+ this . routeDest = path . join ( this . options . endpointDirectory ||
76+ this . config . get ( 'endpointDirectory' ) || 'server/api/' , this . name ) ;
77+ } ;
78+
6979Generator . prototype . writing = function createFiles ( ) {
70- var dest = this . config . get ( 'endpointDirectory' ) || 'server/api/' + this . name ;
7180 this . sourceRoot ( path . join ( __dirname , './templates' ) ) ;
72- ngUtil . processDirectory ( this , '.' , dest ) ;
81+ ngUtil . processDirectory ( this , '.' , this . routeDest ) ;
7382} ;
7483
7584Generator . prototype . end = function registerEndpoint ( ) {
You can’t perform that action at this time.
0 commit comments