Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
PhoneGap and AngularJS for Cross-platform Development

You're reading from   PhoneGap and AngularJS for Cross-platform Development Build exciting cross-platform applications using PhoneGap and AngularJS

Arrow left icon
Product type Paperback
Published in Oct 2014
Publisher
ISBN-13 9781783988921
Length 122 pages
Edition 1st Edition
Languages
Arrow right icon
Authors (2):
Arrow left icon
Yuxian E Liang Yuxian E Liang
Author Profile Icon Yuxian E Liang
Yuxian E Liang
Eugene Liang Eugene Liang
Author Profile Icon Eugene Liang
Eugene Liang
Arrow right icon
View More author details
Toc

Wiring up a backend server

In this section, we will make use of the $http module of AngularJS to make RESTful calls to a simple backend server. The backend server here is based on Facebook's Tornado Framework (https://github.com/facebook/tornado/), but the fact is that you can make RESTful calls using Express.js (http://expressjs.com/) or any other framework that you like.

Before you get started with this section, you will need to have MongoDB (http://www.mongodb.org/), Python 2.7.x, and the Tornado web server installed. You will also need to install a Python library called tornado-cor (https://github.com/globocom/tornado-cors), which facilitates the use of cross-origin resources between your AngularJS app and server.

Coding our server

The main idea of the Python Tornado server is as follows:

  • We have one endpoint, where this endpoint will receive a GET or POST request from our AngularJS app.
  • Depending on the URL argument received, the corresponding handler will perform GET on all to-do...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image