Hello,
I'm new to development and would like to know if there is any way to hide variable information in AngularJs, I'm using a MongoLab API and I did not want to leave my apiKey visible to anyone who debug the code in the browser, I'm running the application with NodeJs and ExpressJs, the server code was generated through ExpressJS CLI
in this way: npm install express-generator -g
and then express meuApp
.
Follow the controller code:
app.controller("RBScontroller", function ($scope, $http) {
$scope.enviar = function enviar(){
var ApiMongo = 'https://api.mongolab.com/api/1/databases/db_test/collections/users?apiKey=Chave_da_APi'; //Gostaria de esconder essa informação
$scope.users = [];
$scope.loading = true;
$http.get(ApiMongo).success(function(data) {
console.log(data);
$scope.users = data;
$scope.loading = false;
}).error(function(msg) {
angular.element($(function(){alert("Fail")}));
$scope.loading = false;
});
}
});