A Sencha Touch 2 application that allows you to share jogging events with your facebook friends. Original example
Original author - Nick Poulden
Features:
- Templates/Template Functions
- Facebook API
- Controllers (References/Actions/Functions)
- Model
- Store
This demo app shows off how to use Facebook with Sencha Touch. To see the app in action, visit:
This example uses the Facebook Javascript SDK on the client side, node.js for the server side and MongoDB for the database.
In order to run this example app, you'll need to set up a Facebook application and deploy the app to a public server. Below we outline how to do so using free accounts from Heroku and MongoLabs.
We assume you're familiar with Git and have it installed.
-
Visit http://www.heroku.com and sign up.
-
Download the Heroku command line toolbelt from http://toolbelt.herokuapp.com/
-
From your command line, type
heroku login
and enter your account details. -
Change to the server-side subdirectory of this example.
-
Set up a git repository:
$ git init
-
Create a new app on Heroku:
heroku create --stack cedar
Note the URL of your live app.
- Visit https://developers.facebook.com/apps and click the 'Create New App' button.
- Fill in the App Display Name and leave the Namespace field blank.
- Note the App ID and App Secret.
- In the 'Select how your app integrates with Facebook' section, click the 'Mobile Web' option and use the domain created for your app on Heroku.
-
Visit https://mongolab.com and sign up.
-
In the 'Databases' section, click 'Add'.
-
Select the 'Free' plan on Amazon EC2, pick a database name, username and password.
-
Click on your new database and note the connection URL. It should look something like this:
mongodb://:@ds029807.mongolab.com:29807/
-
Fill in your Facebook app ID in the
launch
function. -
Open
server-side/app.js
and fill in the config options at the top:redirect_uri
The Heroku app URLclient_id
Your Facebook app IDclient_secret
Your Facebook app secretmongoDb
Mongo connection URL from abovesessionSecret
A random string of characters for session encryption
To run the app locally, you must first update your Facebook app to point to localhost.
- Visit https://developers.facebook.com/apps and select your application.
- In the 'Select how your app integrates with Facebook' section, click the 'Mobile Web' option
and set the domain to
http://localhost:3000
Next we need to build our app, install the required node modules, and then run the app using node.js.
- Run
build.sh
- Change to the
server-side
directory - Install all the required node modeles by running:
npm install
- Run the app by typing:
node app.js
- Visit your app by going to
http://localhost:3000
-
Run
build.sh
-
Change to the
server-side
directory -
Run the following git commands:
$ git add . $ git commit -m "Initial commit" $ git push heroku master
-
Visit your live Heroku URL from your mobile device or Webkit based browser.