-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
I added/updated following lines to the "generator-angular-fullstack" section of my '.yo-rc.json' file:
{ "generator-angular-fullstack": { ....... "routesBase": "/api/v1/", "endpointDirectory": "server/api/v1/", ....... } }
When I run the following command, code gets generated in the server/api/v1 folder instead of server/api/v1/test1
yo angular-fullstack:endpoint test1
The problems appears to be in the "createFiles()" method of the following file:
generator-angular-fullstack/endpoint/index.js
I think the following line (line 73) needs to change
FROM
var dest = this.config.get('endpointDirectory') || 'server/api/' + this.name;
TO
var dest = (this.config.get('endpointDirectory') || 'server/api/') + this.name;
Making the change above generates the files to the correct folder but the paths inside the generated files are incorrect. They are either missing \v1 in their path or the relative path is off by one folder
For example:
routes.js added the following line:
app.use('/api/v1/test1', require('./api/test1'));
instead of:
app.use('/api/v1/test1', require('./api/v1/test1'));
In the generated mocha test file, the relative path to app is off by one folder
it says:
var app = require('../../app');
instead of
var app = require('../../../app');
To fix the mocha test problem, looks like the relative path needs to be added dynamically in generator-angular-fullstack/endpoint/templates/name.spec.js