I'm following literally the official loopback documentation for AngularJS Grunt plugin and I'm facing a problem during the creation of the task under the Grunt file.
The documentation is well done and In the How to use the plugin section it provides an very good example of implementation but it's not clear the meaning of staging
and production
sections.
I'm also interested to provide a different urlBase
for the APIs cause my AngularJS application is served from a different address, so I added the apiUrl
option, but when I start loopback_sdk_angular
task from the Grunt file all goes well but it seems not considering my apiUrl
option within staging
or production
sections (Tried both, nothing changed) building a api.service.js
with var urlBase = '/api'
instead of var urlBase = 'http://127.0.0.1:3000/api'
.
My grunt file:
grunt.loadNpmTasks('grunt-loopback-sdk-angular');
...
//grunt init config
...
loopback_sdk_angular: {
services: {
options: {
input: 'server/server.js', output: 'client/services/api.services.js'
}, staging: {
options: {
apiUrl: 'http://127.0.0.1:3000/api'
}
}
//, production: {
// options: {
// apiUrl: 'http://127.0.0.1:3000/api'
// }
// }
}
}
...
grunt.registerTask('generate-services', ['loopback_sdk_angular']);
//end
Could someone please explain me the meaning of that two sections and what I'm missing to make the var urlBase
to assume the correct value of http://127.0.0.1:3000/api
?