{"id":466,"date":"2018-12-03T15:50:11","date_gmt":"2018-12-03T10:20:11","guid":{"rendered":"https:\/\/cenacle.io\/?p=466"},"modified":"2018-12-03T15:50:11","modified_gmt":"2018-12-03T10:20:11","slug":"feathersjs-realtime-microservices-nodejs","status":"publish","type":"post","link":"https:\/\/gk.palem.in\/articles\/feathersjs-realtime-microservices-nodejs\/","title":{"rendered":"Feathers.JS: Realtime Micro-services with Node.js"},"content":{"rendered":"<p>As a technology consultation provider, Cenacle works with customers from various domains including Automotive, Healthcare, Retail, Energy and BFSI, on solutions ranging from IIOT, Blockchain, EHR, SmartContracts, DevOps, Predictive Analytics etc.<\/p>\n<p>To be able to successfully deliver such varied solutions in a timely manner, we need architectures and frameworks that allow reuse and rapid-development. For majority of our solutions, we use micro-services architecture with backend data controlled through RESTful resources, sockets and flexible data-base plug-ins.<\/p>\n<p>FeathersJS is a realtime, microservices web framework for NodeJs that suits all our above requirements. The micro-services architecture allows reuse, and scalability. RESTful and socket access allow easy integration for cross-language clients to access our functionality.<\/p>\n<p>FeathersJS integrates nicely with various front-end frameworks, such as Vue, and can be used directly from browser code with @feathersjs\/client.<\/p>\n<p>FeathersJS has adapters for 15+ data sources out of the box, including MongoDB, Postgres, RethinkDB etc., which means we can support various customer backends seamlessly.<\/p>\n<p>Optional plugins that support Passport authentication means, flexible authorization with JWT, OAuth1, OAuth2 etc.<\/p>\n<p>Service hooks is a very powerful feature of FeathersJS that allows you plugin any custom code before and after various route handler methods, which is useful to inject loggers, rate limit controllers etc.<\/p>\n<p>Creating a RESTful resource in FeathersJS is as simple as declaring a Javascript class module with below structure:<\/p>\n<pre>const myService = {\n    async find(params) {\n        return [];\n    },\n    async get(id, params) {},\n    async create(data, params) {},\n    async update(id, data, params) {},\n    async patch(id, data, params) {},\n    async remove(id, params) {},\n    setup(app, path) {}\n}\n\napp.use('\/my-service', myService);\n<\/pre>\n<p>Such defined FeathersJS service can be accessed through URL with one of the POST, GET etc. methods, or internally accessed through services, as:<\/p>\n<pre>  const myService = app.service('my-service');\n\n  myService.find().then(items =&gt; console.log('.find()', items));\n  myService.get(1).then(item =&gt; console.log('.get(1)', item));\n<\/pre>\n<p>This allows you to create interleaved services that access each other internally to provide a complex functionality at the application level.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>To be able to successfully deliver varied solutions in a timely manner, we need architectures and frameworks that allow reuse and rapid-development. For majority of our solutions, we use micro-services architecture with backend data controlled through RESTful resources, sockets and flexible data-base plug-ins.<\/p>\n","protected":false},"author":1,"featured_media":556,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"advanced_seo_description":"","jetpack_seo_html_title":"","jetpack_seo_noindex":false,"jetpack_post_was_ever_published":false,"_cloudinary_featured_overwrite":false,"fifu_image_url":"https:\/\/res.cloudinary.com\/cenacle-cdn\/image\/upload\/v1613618528\/CenacleResearch\/blog\/images\/architectural-background-P2CGCM8.jpg","fifu_image_alt":"Feathers.JS: Realtime Micro-services with Node.js","footnotes":""},"categories":[69],"tags":[68,70,71],"class_list":["post-466","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blog","tag-architecture","tag-javascript","tag-tools"],"jetpack_featured_media_url":"https:\/\/res.cloudinary.com\/cenacle-cdn\/images\/v1715779377\/gk.palem.in\/wp_assets\/architectural-background-P2CGCM8\/architectural-background-P2CGCM8.jpg?_i=AA","jetpack-related-posts":[],"jetpack_shortlink":"https:\/\/wp.me\/pfLaRd-7w","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/gk.palem.in\/articles\/wp-json\/wp\/v2\/posts\/466","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gk.palem.in\/articles\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gk.palem.in\/articles\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gk.palem.in\/articles\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/gk.palem.in\/articles\/wp-json\/wp\/v2\/comments?post=466"}],"version-history":[{"count":0,"href":"https:\/\/gk.palem.in\/articles\/wp-json\/wp\/v2\/posts\/466\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/gk.palem.in\/articles\/wp-json\/wp\/v2\/media\/556"}],"wp:attachment":[{"href":"https:\/\/gk.palem.in\/articles\/wp-json\/wp\/v2\/media?parent=466"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gk.palem.in\/articles\/wp-json\/wp\/v2\/categories?post=466"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gk.palem.in\/articles\/wp-json\/wp\/v2\/tags?post=466"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}