Can You Parse My Backend

As developers most of us have had an idea for an app (mobile, web, desktop, or whatever) but just haven’t had enough time to configure and fiddle with a backend stack or system. I mean come on who wants to dedicate 200hrs+ to a proof of concept. Well, I have been working with a nifty little tool called Parse. Parse is a backend in a box so to speak. Basically, you create an account log into a dashboard and start entering data into a spreadsheet; you can even upload a CSV if you like. Best part? Parse has SDK’s for iOS and Android and also has  a REST API that can be used with anything that understands JSON.

Let’s take a fast look at a common use case: you need to authenticate an iOS user via Facebook:

- (void) ourMagicalMethod {
	[Parse setApplicationId:@"SOME_ID" clientKey:@"Your Super Secret KEY"];
	[PFFacebookUtils initializeWithApplicationId:@"SOME_FB_ID"];
	NSArray* permissions @["desired permissions"];
	[PFFacebookUtils loginWithPermissions:permissions block:^(PFUser*     user, NSError* error) {
	// your epic logic goes heres
        }];
}

You can also find this code snippet here.

What’s that you say? You like your code more robotic? No worries. I have you covered with an Android sample:

public void yourMagicalMethod() {
	Parse.initialize(this,"pID" "pKEY");
	ParseFacebookUtils.initialize("fbId");
	ParseFacebookUtils.login(this, new LoginInCallback() {
		@Override
		public void done(Parse user, ParseException err) {
			// your awesome logic
		}
	});
}

Again you can find the snippet here.

With those two snippets you have either created a user in your Parse database if one did not exist for that Facebook account or logged the existing one in. Now that’s not to say that Parse can replace a real custom backend, but for prototyping when time is of the upmost importance or if your resources are severely constrained, it just may do the job.

Got feedback? I’d love to hear on Google+ or Twitter. Also, if you enjoy my work, please consider purchasing Code Journal wither form the Mac App Store or direct. All the snippets you see here were written using Code Journal.

Comments are closed.