{"id":13401792,"url":"https://github.com/Netflix/falcor","last_synced_at":"2025-03-14T07:31:59.643Z","repository":{"id":27259882,"uuid":"30732364","full_name":"Netflix/falcor","owner":"Netflix","description":"A JavaScript library for efficient data fetching","archived":false,"fork":false,"pushed_at":"2023-10-16T18:18:02.000Z","size":23607,"stargazers_count":10490,"open_issues_count":74,"forks_count":447,"subscribers_count":653,"default_branch":"master","last_synced_at":"2025-03-07T17:03:00.771Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://netflix.github.io/falcor","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Netflix.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2015-02-13T00:17:50.000Z","updated_at":"2025-03-07T01:30:20.000Z","dependencies_parsed_at":"2023-10-20T23:15:14.035Z","dependency_job_id":null,"html_url":"https://github.com/Netflix/falcor","commit_stats":{"total_commits":1666,"total_committers":71,"mean_commits":"23.464788732394368","dds":0.6356542617046819,"last_synced_commit":"398d4ef6e2d42f41197c240f1463ef70a9a8dd8b"},"previous_names":[],"tags_count":54,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Netflix%2Ffalcor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Netflix%2Ffalcor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Netflix%2Ffalcor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Netflix%2Ffalcor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Netflix","download_url":"https://codeload.github.com/Netflix/falcor/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243086286,"owners_count":20234008,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-30T19:01:07.205Z","updated_at":"2025-03-14T07:31:59.628Z","avatar_url":"https://github.com/Netflix.png","language":"JavaScript","funding_links":[],"categories":["JavaScript","others"],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://cloud.githubusercontent.com/assets/1016365/8711049/66438ebc-2b03-11e5-8a8a-75934f7ca7ec.png\"\u003e\n\u003c/p\u003e\n\n# Falcor\n\n[![Build Status](https://travis-ci.org/Netflix/falcor.svg)](https://travis-ci.org/Netflix/falcor)\n[![Coverage Status](https://coveralls.io/repos/Netflix/falcor/badge.svg?branch=master\u0026service=github)](https://coveralls.io/github/Netflix/falcor?branch=master)\n\n## 2.0\n\n**2.0** is the current stable Falcor release. **0.x** and **1.x** users are\nwelcome to upgrade.\n\n-   [Breaking changes between **1.x** and **2.0**](https://github.com/Netflix/falcor/blob/master/MIGRATIONS.md).\n-   [Breaking changes between **0.x** and **1.x**](https://github.com/Netflix/falcor/blob/1.0.0/MIGRATIONS.md).\n\n## Roadmap\n\nIssues we're tracking as part of our roadmap are tagged with the\n[roadmap](https://github.com/Netflix/falcor/issues?q=is%3Aopen+is%3Aissue+label%3Aroadmap)\nlabel. They are split into\n[enhancement](https://github.com/Netflix/falcor/issues?q=is%3Aopen+is%3Aissue+label%3Aroadmap+label%3Aenhancement),\n[stability](https://github.com/Netflix/falcor/issues?q=is%3Aopen+is%3Aissue+label%3Aroadmap+label%3Astability),\n[performance](https://github.com/Netflix/falcor/issues?q=is%3Aopen+is%3Aissue+label%3Aroadmap+label%3Aperformance),\n[tooling](https://github.com/Netflix/falcor/issues?q=is%3Aopen+is%3Aissue+label%3Aroadmap+label%3Atooling),\n[infrastructure](https://github.com/Netflix/falcor/issues?q=is%3Aopen+is%3Aissue+label%3Aroadmap+label%3Ainfrastructure)\nand\n[documentation](https://github.com/Netflix/falcor/issues?q=is%3Aopen+is%3Aissue+label%3Aroadmap+label%3Adocumentation)\ncategories, with near, medium and longer term labels to convey a broader sense\nof the order in which we plan to approach them.\n\n## Getting Started\n\nYou can check out [a working example server for Netflix-like application](https://github.com/netflix/falcor-express-demo) right now. Alternately, you\ncan go through this barebones tutorial in which we use the Falcor Router to\ncreate a Virtual JSON resource. In this tutorial we will use Falcor's express\nmiddleware to serve the Virtual JSON resource on an application server at the\nURL `/model.json`. We will also host a static web page on the same server which\nretrieves data from the Virtual JSON resource.\n\n### Creating a Virtual JSON Resource\n\nIn this example we will use the falcor Router to build a Virtual JSON resource\non an app server and host it at `/model.json`. The JSON resource will contain\nthe following contents:\n\n```js\n{\n  \"greeting\": \"Hello World\"\n}\n```\n\nNormally, Routers retrieve the data for their Virtual JSON resource from backend\ndatastores or other web services on-demand. However, in this simple tutorial, the\nRouter will simply return static data for a single key.\n\nFirst we create a folder for our application server.\n\n```bash\n$ mkdir falcor-app-server\n$ cd falcor-app-server\n$ npm init\n```\n\nNow we install the falcor Router.\n\n```bash\n$ npm install falcor-router --save\n```\n\nThen install express and falcor-express. Support for restify is also available,\nas is support for hapi via a [third-party\nimplementation](https://github.com/Netflix/falcor-hapi).\n\n```bash\n$ npm install express --save\n$ npm install falcor-express --save\n```\n\nNow we create an `index.js` file with the following contents:\n\n```js\n// index.js\nconst falcorExpress = require(\"falcor-express\");\nconst Router = require(\"falcor-router\");\n\nconst express = require(\"express\");\nconst app = express();\n\napp.use(\n    \"/model.json\",\n    falcorExpress.dataSourceRoute(function (req, res) {\n        // create a Virtual JSON resource with single key ('greeting')\n        return new Router([\n            {\n                // match a request for the key 'greeting'\n                route: \"greeting\",\n                // respond with a PathValue with the value of 'Hello World.'\n                get: () =\u003e ({ path: [\"greeting\"], value: \"Hello World\" }),\n            },\n        ]);\n    })\n);\n\n// serve static files from current directory\napp.use(express.static(__dirname + \"/\"));\n\napp.listen(3000);\n```\n\nNow we run the server, which will listen on port `3000` for requests for\n`/model.json`.\n\n```bash\n$ node index.js\n```\n\n### Retrieving Data from the Virtual JSON resource\n\nNow that we've built a simple virtual JSON document with a single read-only key\n`greeting`, we will create a test web page and retrieve this key from the\nserver.\n\nCreate an `index.html` file with the following contents:\n\n```html\n\u003c!-- index.html --\u003e\n\u003chtml\u003e\n    \u003chead\u003e\n        \u003c!-- Do _not_  rely on this URL in production. Use only during development.  --\u003e\n        \u003cscript src=\"https://netflix.github.io/falcor/build/falcor.browser.js\"\u003e\u003c/script\u003e\n        \u003c!-- For production use. --\u003e\n        \u003c!-- \u003cscript src=\"https://cdn.jsdelivr.net/falcor/{VERSION}/falcor.browser.min.js\"\u003e\u003c/script\u003e --\u003e\n        \u003cscript\u003e\n            var model = falcor({\n                source: new falcor.HttpDataSource(\"/model.json\"),\n            });\n\n            // retrieve the \"greeting\" key from the root of the Virtual JSON resource\n            model.get(\"greeting\").then(function (response) {\n                document.write(response.json.greeting);\n            });\n        \u003c/script\u003e\n    \u003c/head\u003e\n    \u003cbody\u003e\u003c/body\u003e\n\u003c/html\u003e\n```\n\nNow visit `http://localhost:3000/index.html` and you should see the message\nretrieved from the server:\n\n```\nHello World\n```\n\n## Steps to publish new version\n\n-   Make pull request with feature/bug fix and tests\n-   Merge pull request into master after code review and passing Travis CI checks\n-   Run `git checkout master` to open `master` branch locally\n-   Run `git pull` to merge latest code, including built `dist/` and `docs/` by Travis\n-   Run `npm run dist` to build `dist/` locally\n    -   Ensure the built files are not different from those built by Travis CI, hence creating no change to commit\n-   Update CHANGELOG with features/bug fixes to be released in the new version and commit\n-   Run `npm version patch` (or `minor`, `major`, etc) to create a new git commit and tag\n-   Run `git push origin master \u0026\u0026 git push --tags` to push code and tags to github\n-   Run `npm publish` to publish the latest version to NPM\n\n## Additional Resources\n\n-   For detailed high-level documentation explaining the Model, the Router, and JSON\n    Graph check out the [Falcor website](https://netflix.github.io/falcor).\n\n-   [API documentation](https://netflix.github.io/falcor/doc/Model.html)\n\n-   For a working example of a Router, check out the\n    [falcor-router-demo](https://github.com/netflix/falcor-router-demo).\n\n-   For questions and discussion, use [Stack\n    Overflow](https://stackoverflow.com/questions/tagged/falcor).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FNetflix%2Ffalcor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FNetflix%2Ffalcor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FNetflix%2Ffalcor/lists"}