Skip to content

developit/hello-falcor

 
 

Repository files navigation

hello-faclor

A simple faclor.js example.

This example uses handlbars and some faclor magic to list JS books.

Do check the demo!

Heart of the Server:

app.use('/library.json', falcorExpress.dataSourceRoute(function (req, res) {
  return new Router([
    {
      route: "books.list",
      get: function() {
        return {path:["books"], value: JSON.stringify(Library) };
      }
    },
    {
      route: "books.names",
      get: function() {
        return {path:["books","names"], value: Library.map( book => book.name )};
      }
    }
  ]);
}));

Heart of the client:

var model = new falcor.Model({source: new falcor.HttpDataSource('/books.json') });

model.
  get("books").
  then(function(response) {
        var books = JSON.parse(response.json.books);
   });

License

MIT © Hemanth.HM

Packages

No packages published

Languages

  • HTML 55.7%
  • CSS 24.7%
  • JavaScript 19.6%