N.B This project is very much a work in progress and I haven't decided where it is going. I couldn't find any projects with backends for Ionic apps (MEAN stack) so I decided to make an app with one.
Things are still pretty messy I.E. files are still included which shouldn't be, and it's pretty embarrassing releasing it now, but I thought there's no harm in putting it out there!
[Ionic] (https://github.com/driftyco/ionic) app with NodeJs Express based on a backend generated by [Angular fullstack generator] (https://github.com/DaftMonk/fullstack-demo)
This project uses MongoDB, so having a database listening on Localhost should be fine.
The backend hasn't changed much from one generated by the fullstack generator, so please do see that project for setting environment variables (such as Facebook client IDs), the MongoDB url etc.
[demo] (http://fullstack.joshhargreav.es)
$ git clone https://github.com/hardgreaves/Ionic-app-with-NodeJs-backend
$ cd fullstack
$ npm install & bower install
$ cordova plugin add org.apache.cordova.inappbrowser
$ gulp build
$ node server/app.js
To build/run the project as a native app run from within the client folder. Note that when built as a native app you should chance apiUrl in the config service to the url of your api server.
ionic run [Platform]
This project uses [gulp] (https://github.com/gulpjs/gulp/) along with bower to inject dependencies into www/index.html using the command 'gulp build'. Run gulp sass from within the client folder to generate CSS from the ionic.app.scss file in SCSS. (This will be fixed shortly...)
##Social Login As per the Angular fullstack backend, login via Facebook, google and twitter is implemented backend wise. It should just be a case of setting the environment variables for client urls and using the oauth function in the login controller.
Currently I've used the cordova [in app browser] (https://github.com/apache/cordova-plugin-inappbrowser/) plugin to open a page at http://yourserver.com/auth/facebook (for example). This then redirects to the login page for that provideer, which in turn redirects to /auth/provider/callback which then redirects to the default page with a token as a paramter. The app checks the URL when a 'loadstart' event is fired on the created window, and parses the URL for this token. One this token is obtained, it can be added to the cookies, and request for the user object can be made.
##Styling Style the app in the file in the SCSS folder, and run gulp sass (from client folder)
Please feel to make pull requests, fork the project and direct mesesage me.