session-less use of jwt and passport.js
note: by module I mean either a javascript (.js) or coffeescript (.coffee) file
install the following:
- sailsjs
| public getForecast(days: number) { | |
| // Parameters obj- | |
| let params: URLSearchParams = new URLSearchParams(); | |
| params.set('appid', StaticSettings.API_KEY); | |
| params.set('cnt', days.toString()); | |
| //Http request- | |
| return this.http.get(StaticSettings.BASE_URL, { | |
| search: params | |
| }).subscribe( |
| 'use strict'; | |
| /** | |
| * Module dependencies | |
| */ | |
| var actionUtil = require('sails/lib/hooks/blueprints/actionUtil'), | |
| _ = sails.lodash; | |
| var async = require('sails/node_modules/async'); | |
| /** |
| /* Original source: https://gist.github.com/oskarrough/914653b03d886c015320 | |
| * Modified fork: https://gist.github.com/consideRatio/761c6286158e70feaed7 | |
| * | |
| * Working authentication with | |
| * Firebase 2.0.x + Ember.js 1.8.1 + Ember Data Canary + EmberFire 1.3.0 + Ember CLI | |
| * works for me! oskar@rough.dk | |
| * | |
| * Note: this assumes you've set up login on your Firebase, | |
| * only handles Google and Facebook for now. | |
| * |
| // Router | |
| import Ember from 'ember'; | |
| var Router = Ember.Router.extend({ | |
| location: ClientENV.locationType | |
| }); | |
| Router.map(function() { | |
| this.resource('login'); | |
| this.resource('secretRouteToBeProtected'); |
| var dbRef = new Firebase("https://YOUR-FIREBASE.firebaseio.com/"); | |
| export default Ember.Controller.extend({ | |
| /** | |
| @property currentUser | |
| @type {User} | |
| @default null | |
| */ | |
| currentUser: null, |
Data Down / Actions Up
Plain JSBin's
Ember Version Base JSBin's
| App.MonthlyDatepickerComponent = Ember.Component.extend({ | |
| classNames: ['dp'], | |
| didInsertElement: function() { | |
| var _this = this; | |
| this.$().datepicker({format: 'M-yyyy',minViewMode: 'months'}) | |
| .on('changeDate', function(e) { | |
| _this.sendAction('action', e.format()); | |
| }); | |