Commit cbe750f8043c9fb67333c786af4efce5ec5399d9

Authored by Victor Costa
1 parent b78762c8
Exists in master and in 1 other branch dev-fixes

Start to build noosfero api service

gulp/server.js
@@ -26,14 +26,7 @@ function browserSyncInit(baseDir, browser) { @@ -26,14 +26,7 @@ function browserSyncInit(baseDir, browser) {
26 routes: routes 26 routes: routes
27 }; 27 };
28 28
29 - /*  
30 - * You can add a proxy to your backend by uncommenting the line below.  
31 - * You just have to configure a context which will we redirected and the target url.  
32 - * Example: $http.get('/users') requests will be automatically proxified.  
33 - *  
34 - * For more details and option, https://github.com/chimurai/http-proxy-middleware/blob/v0.9.0/README.md  
35 - */  
36 - // server.middleware = proxyMiddleware('/users', {target: 'http://jsonplaceholder.typicode.com', changeOrigin: true}); 29 + server.middleware = proxyMiddleware('http://localhost:3000/api', {changeOrigin:true});
37 30
38 browserSync.instance = browserSync.init({ 31 browserSync.instance = browserSync.init({
39 startPath: '/', 32 startPath: '/',
src/app/components/noosfero/noosfero.service.js
@@ -3,7 +3,15 @@ @@ -3,7 +3,15 @@
3 3
4 angular.module('angular').service('noosfero', noosfero); 4 angular.module('angular').service('noosfero', noosfero);
5 5
6 - function noosfero() {  
7 - 6 + function noosfero($resource) {
  7 + this.communities = communities;
  8 + function communities() {
  9 + return $resource('/api/v1/communities/:id');
  10 + }
  11 + // this.getBoxes = getBoxes;
  12 + // function getBoxes() {
  13 + // return [{id: 1, blocks: [{id: 1, type: 'test'}]},
  14 + // {id: 2, blocks: [{id: 2, type: 'test2'}]}];
  15 + // }
8 } 16 }
9 })(); 17 })();
src/app/main/main.controller.js
@@ -12,6 +12,9 @@ @@ -12,6 +12,9 @@
12 activate(); 12 activate();
13 13
14 function activate() { 14 function activate() {
  15 + var profile = noosfero.communities().get({id: 67, private_token: '1b00325e5f769a0c38550bd35b3f1d64'}, function () {
  16 + console.log(profile);
  17 + });
15 // vm.boxes = noosfero.getBoxes(); 18 // vm.boxes = noosfero.getBoxes();
16 } 19 }
17 } 20 }