Vatican.js 1.3, get your API up and running without writing a single line of code

A few weeks ago, I released version 1.3 of Vatican.js, my microframework design to ease the process of writing APIs in Node.js.
My goal with Vatican has always been speed of development. And the main focus on version 1.3 is getting up and running as fast as you can.
With that in mind, what are the basics things that an API would need to have to be usable (we’re talking MVP level of usable):

  • Web server: We need something to hit, so the web server is kind of important.
  • Resource handlers: Vatican’s focus are REST APIs, so resources are a basic need here.
  • A database connection: Because we want to save persist information from the get go
  • Resource representation for db: We’re working with an ORM so we need an object representation of the data

That’s about it, if we want to test a concept, having all of that out of the box, would be pretty helpful, don’t you agree?
Back with version 1.2 of Vatican, you’d have the first two out of the box, but the resource handlers wouldn’t do anything. So that wasn’t good enough.
Now with verson 1.3, Vatican will auto-generate as much code as it can for you, so the basic CRUD actions will be there already. Currently the storage engine used is MongoDB, with the Mongoose module but I’m planning on allowing for other options in the future.
Continue reading

Fork me on GitHub
Tagged , , , ,

Creating a simple REST API with Vatican.js

A couple of weeks ago, I released to the inter-world my take at what a microframework for creating API’s should look like. I called it Vatican.js.
I got some interesting responses, but mostly, because of the name, so I thought I’d write a little post explaning how to go about creating a REST API from scratch using Vatican.
Continue reading

Tagged , ,

Last few days for Packt’s 2000th -Buy one get one Free Campaign

2000th-Book-Home-Page-Banner

They got IT covered

Get a move on! That’s right, Packt has had a Buy one get one Free Campaign for all of their e-books since March 18th  to commemorate their 2000th published title: “Learning Dart”.

And to celebrate, they’re going to be giving away a free e-book to everyone go buys  one.

From their press release:

David Maclean, Managing Director explains `It’s not by chance that this book is our 2000th title. Our customers and community drive demand and it is our job to ensure that whatever they’re working on, Packt provides practical help and support.

At Packt we understand that sometimes our customers want to learn a new programming language pretty much from scratch, with little knowledge of similar language concepts. Other times our customers know a related language fairly well and therefore want a fast-paced primer that brings them up to a competent professional level quickly.

That’s what makes Packt different: all our books are specifically commissioned by category experts, based on intensive research of the technology and the key tasks.’

 

So, stop what you’re doing and get your new e-book now!

Tagged ,

Node.js::Getting around Github’s Raw resources limitations

It’s a very common scenario: you finally find the file you’re looking for to start using on your website (be it a jquery plugin, an angular directive, or whatever you can include on your website) on Github, navigate to that file, hit the “raw” link and then copy the URL.

But when you try it on your site, it won’t work… , you check the Network tab on your favourite browser and you see that the resource is being interpreted as a plain text file, so your browser doesn’t know what to do with it.

Not cool Github! (well, to be fair, I don’t think they intended their site to act as a CDN).

I’ll quickly go over two solutions to this problem…

Continue reading

Tagged , , , ,

Review – Google Maps JavaScript API Cookbook

A few weeks ago, I was asked by the PackT publisher to review one of their recent books: “Google Maps JavaScript API Cookbook”. Here is what I think of it:

The book

Google Maps Javascript API Cookbook“Google Maps JavaScript API Cookbook” is relatively a short book, it’s full of, like the name of the book suggests, recipes to work with the Google Maps API.
Both authors, Alper Dincer and Balkan Uraz share a MS degree in Geographical Sciences and have over 10 years of experience working on Geographic Information Systems. So it’s safe to say they know their GIS. That being said, this is a programming cookbook, so the quality of the recipes is not assured.
I’ll go over the good and the bad bellow.

Continue reading

Tagged , , , ,

Javascript: Dealing with “callback-soup” without an external library

Whether you’re working on the browser or on the server side, you might’ve run into what I like to call: Callback Soup.

This happens when you start queuing one callback after the other. This is very common when you’re dealing with asynchronous code (AJAX calls, or regular IO on Node.js for instance).

When this happens, we end-up with code that looks like this:

function mainFunction() {
   getData(function(err, result) {
      getMoreData(result, function(err2, moreResults) {
          finallyGetLastData({first: result, second: moreResults}, function(err3, finalResults) {
               //Do something with all the results here...
          });
      });
   });
}

Error handling left out for simplicity reasons
Continue reading

Tagged , ,

Makiavelo:: Now with Migrations!

That’s right! The latest code from Makiavelo just got a new feature: migrations.

In my never ending journey of re-inventing the wheel, a.k.a building my own web framework for PHP, I’ve recently updated the code with a new feature, migrations.
Whether you implement this feature like Rails does or anyother way, it is important to have a way to control the changes to the database in a way that allows to easily go back and forth between them. It is always a plus to have record of each change done to the database, I think it helps maintainability.
Continue reading

Tagged , ,

PHP::Makiavelo writing a simple blog Part II

On my previous post I talked about the basic steps needed to start up our mini-blog project on Makiavelo.

Now I’ll talk about the few lines of code needed to get the controllers ready and the configuration needed to setup the virtual host on Apache.

Let’s get down to business, shall we?

Continue reading

Tagged , ,

PHP::Writing a simple blog in Makiavelo Part I

Makiavelo is a new PHP Web Framework that’s in the works, you can find out more about it here.
I think that the best way to learn a about a new framework, is to create something that actually works with it, so I’ll go over a simple “blogging” application that will cover the basics:

  • Using the command line to create entities
  • Setting up basic user authentication
  • Basic html formatting
  • Apache configuration required to setup our virtual host.

So, lets go over the example….(I’ll assume you’ve been to the GitHub page and read the docs). In part I, I’ll cover:

  1. Setting up database
  2. Setting up entities
  3. Messing with routes
    Continue reading
Tagged , ,

How to REST and not die trying – Writing API’s the REST way

I’ve been interacting with APIs for several years now, I’ve seen good things, and I’ve seen bad things. I’ve seen quite a lot of XML with SOAP, and I’ve seen a lot of JSON with REST APIs.

I’m not ashamed (maybe I should be) to say that the few times I had to write my own, they were actually inside the “bad” bag.
So when I was faced with the task of creating a mid-size API to be used from a mobile device, I decided to read up a bit on how to do it properly for once.

So, lets get down to business.
Continue reading

Tagged , ,