Forum for discussing general topics related to Couch.
14 posts Page 1 of 2
Hi all couchers,

I have a big question and big hopes :)

Does anyone here have any experience with making APP for android and IOS with Couch Cms in back-end?

I have a on going project and i would like to have a APP for some of the functions that i can controll with my couch cms!

Looking forward to hear about any experience with this :)
kimheggen wrote: Hi all couchers,

I have a big question and big hopes :)

Does anyone here have any experience with making APP for android and IOS with Couch Cms in back-end?

I have a on going project and i would like to have a APP for some of the functions that i can controll with my couch cms!

Looking forward to hear about any experience with this :)


Hi Kim!

Im in progress create android app with couch backend.
Its a simple dictionary (my local language dictionary).
The app build with angular, and get the dictionary database via couch generated json file.
As soon as possible!

Touch me up : abada[dot]zulma[at]gmail[dot]com
Hi,

I think this is a use-case where 'custom routes' (viewtopic.php?f=5&t=8981) can come in real handy.

For example, we can use a single template on the back-end, define custom routes within it to cater to all kinds of queries the frontend (the app in this case) will generate.

Then in response to those queries from the app, this template can call in various snippets that use <cms:pages>, <cms:folders> etc. to generate output in either XML or JSON to return to the app.

Using custom-routes will make it easier to enforce authentication, security etc. and also make things more manageable.

The front-end is concerned only with the XML/JSON responses it gets and remains agnostic as to which CMS produces those responses.

Perhaps @GoingMarryAsap would care to share his code when it is ready :)

Hope this reply helps.
KK wrote: Hi,

I think this is a use-case where 'custom routes' (viewtopic.php?f=5&t=8981) can come in real handy.

For example, we can use a single template on the back-end, define custom routes within it to cater to all kinds of queries the frontend (the app in this case) will generate.

Then in response to those queries from the app, this template can call in various snippets that use <cms:pages>, <cms:folders> etc. to generate output in either XML or JSON to return to the app.

Using custom-routes will make it easier to enforce authentication, security etc. and also make things more manageable.

The front-end is concerned only with the XML/JSON responses it gets and remains agnostic as to which CMS produces those responses.

Perhaps @GoingMarryAsap would care to share his code when it is ready :)

Hope this reply helps.

Sure KK!

What i make just a simple angular http.get that read json output generate by couch.

Btw, is it possible to use http.post, put & delete with couch?
As soon as possible!

Touch me up : abada[dot]zulma[at]gmail[dot]com
GoingMarryAsap wrote:
kimheggen wrote: Hi all couchers,

I have a big question and big hopes :)

Does anyone here have any experience with making APP for android and IOS with Couch Cms in back-end?

I have a on going project and i would like to have a APP for some of the functions that i can controll with my couch cms!

Looking forward to hear about any experience with this :)


Hi Kim!

Im in progress create android app with couch backend.
Its a simple dictionary (my local language dictionary).
The app build with angular, and get the dictionary database via couch generated json file.


Interesting, i will for sure follow and see when you share code if you want to :)

My APP will contain a simple front end with info and 4 to 5 different databound-form pages where the users can add data to DB used with couch system in back-end.

My challange is actually to make the APP, but with time we can learn alot, and i have for some time now wanted to learn angular so thats a good tip :)
@GoingMarryAsap,
What i make just a simple angular http.get that read json output generate by couch.
Not a problem. A simple Couch page will work too. It is when you need a lot many 'end points' that, I think, you'll find using custom routes make things much easier.

Btw, is it possible to use http.post, put & delete with couch?
The custom routes support specifying which HTTP method to accept using the 'method' parameter e.g. as follows -
Code: Select all
<cms:route
    name="article_show"
    path="articles/{:locale}/{:year}/{:title}.{:format}"
    secure='1'
    method='get|post'
/>

The code above will accept only GET or POST requests (the 'secure' parameter, incidentally, will allow only 'https'). You can use PUT, DELETE etc. there.

Basically, it will make Couch check the $SERVER['REQUEST_METHOD'] for the methods specified so you can use any verb supported by HTTP.

Hope it helps.
Hi KK, Hi Kimhegen.

Just like KK ask to share the code, i already make a live couch backend on my box, that generate json output and show it on android app with angularjs.

This is an old project, and use Intel XDK, so if you want to build it with a newer version of intel XDK, small adjusment maybe required.

Open :
Code: Select all
www\app\js\controllers.js


Code: Select all
var artistControllers = angular.module('artistControllers', ['ngAnimate']);

artistControllers.controller('ListController', ['$scope', '$http', function($scope, $http) {
  $http.get('http://139.59.236.25/kampret/kamus.php?q=data.json').success(function(data) {
    $scope.artists = data;
    $scope.artistOrder = 'name';
  });
}]);

artistControllers.controller('DetailsController', ['$scope', '$http','$routeParams', function($scope, $http, $routeParams) {
  $http.get('http://139.59.236.25/kampret/kamus.php?q=data.json').success(function(data) {
    $scope.artists = data;
    $scope.whichItem = $routeParams.itemId;

    if ($routeParams.itemId > 0) {
      $scope.prevItem = Number($routeParams.itemId)-1;
    } else {
      $scope.prevItem = $scope.artists.length-1;
    }

    if ($routeParams.itemId < $scope.artists.length-1) {
      $scope.nextItem = Number($routeParams.itemId)+1;
    } else {
      $scope.nextItem = 0;
    }

  });
}]);


You can see there, i get the couch generated json file from my box. And yes, with that url structure, i use custom route.


If you want to add more data, go here :
Code: Select all
http://139.59.236.25/kampret/couch


Creds : demo-12345

Add your data, check the generated json, and refresh your app.

This is the code i use on couch :
Code: Select all
<?php require_once( 'couch/cms.php' ); ?>

   <cms:template title='Isi Kamus' clonable='1' dynamic_folders='1' routable='1'>
   
      <!-- define routes -->
        <cms:route name='list_view' path='data{:format}' />
         <cms:route_constraints
                format='(\.json)'
            />
       
       
      
      <!-- define editable -->
      <cms:editable
         name='mongondow'
         label='Mongondow'
         type='text'
         order='1'
      />
      
      <cms:editable
         name='indonesia'
         label='Indonesia'
         type='text'
         order='2'
      />
      
      <cms:editable
         name='cara_penggunaan'
         label='Cara Penggunaan'
         type='textarea'
         order='3'
      />
      
   </cms:template>
   
   <cms:match_route debug='0' is_404='1' />
   
   <cms:php>header('Access-Control-Allow-Origin: *');</cms:php>
   
   <cms:if k_matched_route='list_view'>
      
      <cms:content_type 'application/json'/>
      
      [
         <cms:pages>
         {
            "mongondow":"<cms:show mongondow />",
            "indonesia":"<cms:show indonesia />",
            "kategori":"<cms:show k_page_foldertitle />",
            "cara":"<cms:show cara_penggunaan />"
         }<cms:if "<cms:not k_paginated_bottom/>">,</cms:if>
         </cms:pages>
      ]
   
   
   </cms:if>

<?php COUCH::invoke(); ?>



Maybe if i have free time from my work, i will try to expanding the app. Just wanna try with extended user, so the user can sign in on the app, and add a data from app.


Thx!


Note

Btw KK, sorry for use paid license on that, cos the json generate the copyright of couch. Its just for educational purpose, not commercial, i can delete it if you want.



Update :

Here is the compiled apk. Install it on your android device. Tested on kitkat.
Link

Attachments

As soon as possible!

Touch me up : abada[dot]zulma[at]gmail[dot]com
Thanks @GoingMarryAsap.

Btw KK, sorry for use paid license on that, cos the json generate the copyright of couch. Its just for educational purpose, not commercial, i can delete it if you want.
Not a problem at all, mate :)
KK wrote: Thanks @GoingMarryAsap.

Btw KK, sorry for use paid license on that, cos the json generate the copyright of couch. Its just for educational purpose, not commercial, i can delete it if you want.
Not a problem at all, mate :)


Thx KK!
I hope my code can help kimhegen.

Btw KK, any advice for user auth between couch extended user and angular http request?
As soon as possible!

Touch me up : abada[dot]zulma[at]gmail[dot]com
Code: Select all
Btw KK, any advice for user auth between couch extended user and angular http request?
I think the problem is that Couch uses cookie based authentication and Angular does not send back cookies with its requests.

We'll have to convert it to some kind of token based authentication to make things work.

However, my friend, I regret I won't be able to attend to this issue at this moment as the current priority is Couch v2.0.

But I promise, I'll definitely work on it once v2.0 is out.
14 posts Page 1 of 2

Who is online

In total there are 3 users online :: 0 registered, 0 hidden and 3 guests
(based on users active over the past 5 minutes)

Users browsing this forum: No registered users and 3 guests

cron