Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Continues What? Javascript?

Continues What? Javascript?

How make Continoues Integration with AngularJS and Jasmine tests, using PhantomJS to make reports for Jenkins in cobertura and junit format.

Ladislav Prskavec

June 02, 2012
Tweet

More Decks by Ladislav Prskavec

Other Decks in Technology

Transcript

  1. module = angular.module('todoApp', []) # Controller TodoCtl module.controller 'TodoCtrl', ($scope,

    $http) -> $scope.todos = []; # Proxy to MongoHQ $scope.url = "proxy.php" # Get all todos from mongodb $scope.getAll = -> $http.get($scope.url).success($scope.getCallback) return $scope.getCallback = (data, status, headers, config) -> $scope.todos = data return # Add new todo $scope.addTodo = -> id = new Date().getTime() $scope.data = '{"document" : {"_id": "' + id + '" , ... todo = {text:$scope.todoText, done:false} $scope.todos.push(todo) $http.post($scope.url, $scope.data).success($scope.sucessCall) return AngularJS
  2. <?php require_once __DIR__ .'/config.php'; header('Content-type: application/json'); $url = "https://api.mongohq.com/databases/mongo/collections/todo/ documents?_apikey="

    . MONGOHQ_API_KEY; $postData = file_get_contents("php://input"); if (!empty($postData)) { $ch = curl_init($url); curl_setopt($ch, CURLOPT_POST ,1); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-type: application/json')); curl_setopt($ch, CURLOPT_POSTFIELDS , $postData); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_FOLLOWLOCATION ,1); curl_setopt($ch, CURLOPT_HEADER , 1); echo curl_exec($ch); } else { echo file_get_contents($url); } Integration MongoHQ
  3. Flickr credits • 123646856 • 212999782 • 3212942388 • 4090782772

    • 4489747597 • 4572739839 • 5462861556 • 5474897335 • 6315847523 • 6711727919