Ember.js and the tale of the Oauth, API, and Deploy
If you don't remember...
I talked about Ember.js last time. Check out my last presentation! (https://slides.com/garrickcheung/ember-hey-this-looks-interesting/)
Once Upon... A Galaxy Far Far... You're in a room...
- Oauth
- API
- Deploy
Oauth and the External Services
Why bring it up? Addons!
- ember-simple-auth
- torii
ember-simple-auth
A lightweight library for implementing authentication/authorization in Ember.js applications
ember-simple-auth
it maintains a client side session and synchronizes its state across multiple tabs/windows of the application
ember-simple-auth
it authenticates the session against the application's own server, external providers like Facebook etc.
ember-simple-auth
it authorizes requests to backend servers"
torii
A set of clean abstractions for authentication in Ember.js applications.
Two authentication libs?
- ember-simple-auth:about session management, authenticating strategy, and authorizing requests.
- torii: interfacing with external authentications.
Show the code!
API and the Handler
Show the code!
- Model
- Serializer
- Adapter
The REST and the RESTLess
Use the Adapter, Lu..
// app/mixins/non-rest-action.js
import Ember from 'ember';
export default Ember.Mixin.create({
nonRestAction: function (action, method, data) {
const modelName = this.constructor.modelName;
const adapter = this.container.lookup(`adapter:${modelName}`);
return adapter.ajax(this.getActionUrl(action, adapter), method, { data: data });
},
getActionUrl: function(action, adapter) {
const modelName = this.constructor.modelName;
const id = this.get('id');
return `${adapter.buildURL(modelName, id)}/${action}`;
}
});
* http://articles.jeffjewiss.com/non-restful-actions-mixin-for-ember-data-model/
Show the code!
Deploy and the Road
ember-cli-deploy
A deployment pipeline for your Ember.js apps created with Ember CLI.
Why should I use it? I already have a deployment script.
How does it work?
- Choose and configure plugins
- Execute
- Profit
Show the code!
End.
- Oauth with ember-simple-auth and torii
- API with Ember Data
- Deploy with ember-cli-deploy + plugins
Ember.js and the tale of Oauth, API, and Deploy
By Garrick Cheung
Ember.js and the tale of Oauth, API, and Deploy
- 1,088