Which Falcor router implementation are out there? - falcor

Is there any existing server-side implementation of Falcor route for various programming languages?

JavaScript
So far besides the official:
https://github.com/Netflix/falcor-router-demo
I've found this one to be another good example:
https://github.com/tivac/falcor-experiment/

Although this is not a language, I'm working on a 'Model to Redis' implementation of the router.
https://www.npmjs.com/package/falcor-ioredis
This model:
{
"somethingById": {
"1": {
"Foo": "Bar"
},
"2": {
"Baz": "Baq"
}
}
}
Would be set in Redis as:
HSET somethingById 1 { "Foo": "Bar" }
HSET somethingById 2 { "Baz": "Baq" }

.NET
For .NET Framework there is an implementation of the router [in progress].
https://github.com/pvasek/falcor-net
Also could be installed as a Nuget Package
Install-Package Falcor.Router.Owin

Related

How to disable V2 OData $batch request by default in UI5?

I made a Master-Detail application in Web IDE with SAPUI5.
I connected my application to an OData service (V2). The connection parameters have been stored in manifest.json.
I want to prevent my UI5 application from using $batch requests.
I know how to use the following code to disable batch request for a particular request:
var oDataModel = this.getModel(); // sap.ui.model.odata.v2.ODataModel
oDataModel.setUseBatch(false);
But the problem is that I can not use this in onInit function.
Can I set some parameter in manifest.json to disable batch request in general and even when the program is loading it does not use $batch?
You should be able to add parameter useBatch to the settings of your model. According to the documentation (section /sap.ui5/models) these settings will be passed to the constructor.
{
"sap.ui5": {
"models": {
"yourV2ODataModel": {
"dataSource": "yourDataSource",
"settings": {
"useBatch": false
}
}
}
}
}
The availability of component models in onInit has been discussed here several times. See the application init process to see why they are not available.
Well you could to it in the onInit function. But like this:
var oDataModel = this.getOwnerComponent().getModel();
oDataModel.setUseBatch(false);
Go to Component.js
on its "init" method:
this.getModel("yourDesiredModel").setUseBatch(false)

Root path for Backbone urls (Backbone.js depoyed in suburi)

I have my Rails and Backbone.js application deployed to a suburi. What is the best way to prepend all request with the suburi?
Example: application is deployed to www.example.com/app. I have a resource users and I'd like backbone to call www.example.com/app/users instead of the default www.example.com/users.
I'm setting a ROOT_URI variable on the server side and I'm going to use it in the backbone app. The simple way is to add it to all urls in models and collections, but it's tedious and error prone. What should I do? Override Backbone.sync?
you can pass URL on your Fetch call
Example
model.fetch({
url: yourServiceURL,
success: function (response, xhr)
{
//console.log("Successfully Fetched...");
},
error: function()
{
//console.log("Error Occurred...");
}
});
in this way you don't have to define url in your model and collections
EDIT
what i understand from your comment. you can do something like this
yourModel = Backbone.Model.extend({
url:function() {
return yourGlobalVarForRootURI+"/staticLogicalPathForEachModel";
},
parse: function (response) {
return response;
}
});
in this way you can give yourGlobalVarForRootURI variable in all of your models/collections and you can change this global variable so it will be changed in all models/collection. I hope it will solve your problem

Rails 3 + angularjs + minification does not work in production: Unknown provider: eProvider

I've followed all the instructions I can find for fixing minification, e.g.
var MyController = function(renamed$scope, renamedGreeter) {
...
}
MyController.$inject = ['$scope', 'greeter'];
and
someModule.factory('greeter', ['$window', function(renamed$window) {
...;
}]);
yet angular refuses to work still. It always throws the error "Unknown provider: eProvider"
Here are my two attempts to get it working... can anyone help?
https://github.com/jemminger/angular-test1
https://github.com/jemminger/angular-test2
They've already had the assets precompiled and development mode is configured to work as production, so you should just be able to "rails s" to see it (not) work.
Found it! They never said to apply the injection fixes to services too... The solution is to change this:
angular.module('itemServices', ['ngResource']).
factory('Item', function($resource){
return $resource('items/:item_id.json', {}, {
query: {method:'GET', params:{ item_id: 'all' }, isArray:true}
});
});
to this:
angular.module('itemServices', ['ngResource']).
factory('Item', ['$resource', function($resource){
return $resource('items/:item_id.json', {}, {
query: {method:'GET', params:{ item_id: 'all' }, isArray:true}
});
}]);
Remember, to also use DI on controllers within directives. Took me hours... CS example:
wrong:
controller: ($scope) ->
$scope.closeModal = ->
ModalService.close()
right:
controller: ["$scope"
($scope) ->
$scope.closeModal = ->
ModalService.close()
]
Make sure to apply the DI pattern to ALL function definitions that require injection within your module. It can be easy to miss one. If you're using a routeProvider, factory, services, etc., they all need to have the DI pattern applied. I ended up deploying multiple times before I caught them all :P

Creating plugin scanner with StructureMap

I'm attempting to write a StructureMap plugin scanner for Payment Gateway implementations. I have created an IPaymentGateway interface in an external library. I have created several implementations of IPaymentGateway and put those .dlls in my C:\Extensions\ folder.
Here is my StructureMap configuration:
ObjectFactory.Initialize(cfg =>
{
cfg.Scan(scanner =>
{
scanner.AssembliesFromPath(#"C:\Extensions\");
});
});
Here is my calling code:
var list = ObjectFactory.GetAllInstances<IPaymentGateway>().ToList();
list.ForEach(item => Console.WriteLine(item.FriendlyName));
I would expect that the list should contain each of my implementations of IPaymentGateway, but it doesn't contain anything. What am I missing?
Thanks!
You need to add the types using the scanner:
ObjectFactory.Initialize(cfg => {
cfg.Scan(scanner =>
{
scanner.AssembliesFromPath(#"C:\Extensions\");
scanner.AddAllTypesOf<IPaymentGateway>();
});

Grails webflow url rewriting

Want to make the URLs SEO friendly when using grails webflow. It is quite limiting with the convention grails uses and hard to go around the way it's built.
For example, i have a flow called fooProcess in the controller called FooController, when i trigger the flow i would like the display: /foo/bar/test, instead of /foo/fooProcess?excecution=e1s2
class FooController {
def fooProcessFlow {
showFoo {
}
}
}
I tried using redirect and specify the uri but that's not supported, grails complains that the page isn't found
fooProcessFlow {
showFoo {
redirect(uri:"/foo/bar/test")
}
}
grails/foo/fooProcess.dispatch/externalRedirect:/foo/bar/test
Also, a redirect is an end state in a flow, if I only want to render the page, i have to use the render method and specify the view name or structure my views according to webflow convention.
fooProcessFlow {
showFoo {
render(view:"/foo/bar/test")
on "add".to "add"
}
}
The url will be in this case
/foo/fooProcessProcess?execution=e6s1
Anyone dealt with this case before ?
Did anyone use UrlRweriteFilter with webflows in grails
http://code.google.com/p/urlrewritefilter/
ken
You can use URLMappings Grails Plugin
See: http://grails.org/doc/latest/ref/Plug-ins/URL%20mappings.html
Edit this file: grails-app/conf/UrlMappings.groovy
Putting something like this inside:
class UrlMappings {
static mappings = {
"/foo/bar/test" (controller: "foo", action: "fooProcessFlow")
"/$controller/$action?/$ids?"{
constraints {
}
}
}
}

Resources