File tree Expand file tree Collapse file tree 1 file changed +19
-2
lines changed
Expand file tree Collapse file tree 1 file changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -11,13 +11,30 @@ var Generator = module.exports = function Generator() {
1111
1212util . inherits ( Generator , ScriptBase ) ;
1313
14- Generator . prototype . registerEndpoint = function ( ) {
14+ Generator . prototype . askFor = function askFor ( ) {
15+ var done = this . async ( ) ;
16+ var name = this . name ;
17+ var prompts = [
18+ {
19+ name : 'route' ,
20+ message : 'What will the url of your endpoint to be?' ,
21+ default : '/api/' + name + 's'
22+ }
23+ ] ;
24+
25+ this . prompt ( prompts , function ( props ) {
26+ this . route = props . route ;
27+ done ( ) ;
28+ } . bind ( this ) ) ;
29+ } ;
30+
31+ Generator . prototype . registerEndpoint = function registerEndpoint ( ) {
1532 if ( this . config . get ( 'insertRoutes' ) ) {
1633 var config = {
1734 file : this . config . get ( 'registerRoutesFile' ) ,
1835 needle : this . config . get ( 'routesNeedle' ) ,
1936 splicable : [
20- "app.use(\'/api/ " + this . name + "s \', require(\'./api/" + this . name + "\'));"
37+ "app.use(\'" + this . route + " \', require(\'./api/" + this . name + "\'));"
2138 ]
2239 } ;
2340 ngUtil . rewriteFile ( config ) ;
You can’t perform that action at this time.
0 commit comments