Skip to content

Instantly share code, notes, and snippets.

View snapjay's full-sized avatar
💭
When you do things right, people won't be sure you've done anything at all.

snapjay snapjay

💭
When you do things right, people won't be sure you've done anything at all.
View GitHub Profile
@atuttle
atuttle / api.js
Created February 4, 2014 14:31
Angular.js REST API Service Wrapper
app.factory('API', function($http, $q){
var basePath = 'http://domain.com/api/path';
// => http://domain.com/api/path/foo/bar
function makeRequest(verb, uri, data){
var defer = $q.defer();
verb = verb.toLowerCase();
//start with the uri