DEV Community

Dhiraj kumar Nayak
Dhiraj kumar Nayak

Posted on

Make Node.js app realtime with less effort.

It is easy to build Rest API using the express framework in node.js. But if you want to build a realtime application the change in the database reflects suddenly to the users then implementing socket.io you can make it but it is quite hard to implement the realtime feature, here comes the easy solution for you feathers js.

what is feathers js ??

It is a framework for real-time application and for making the rest API at no cost. this will provide a real backend framework where the code structure has maintained you easily build an application with minimum efforts. It supports databases like mongoose, post grays, almost every database.

How you can install it

TO start with feathers backend you have to start with installing the feathers-cli, which is a command-line interface tool that helps you to generate an application.

how to generate Feathers app

  1. feathers generate app this command will going to ask questions like what should be your project name your preferences javascript or typescript.

then it going to ask you question which database you like to implement
would you like to use the user authentication?

after some questions, it will go to generate an app for you.

how it going to work

it has 3 main things in the src folder where 90% of our work we do.
=> model Folder
=> hooks folder
=> sevices

Models: the model folder contains the model of your data you want to use in your project which is linked to your preferred databases. when you create any service it is going to automatically generate.

Hooks: Hooks are the functions that are implemented before, after, or error the application. hooks have the context
of an object that contains the app, user-related data that can be manipulated before and after the data used. you can create a hook by running feathers generate hook It will generate a hook

Services: Services contain the whole application rest API operation done through the services. you can make a change in the services to manipulate the data of the API. you can generate service by running the command feathers generate service

Feathers is easy to learn to go through the documentation for a clear understanding.

Go to feathers

Discussion (0)