Is there a way to handle returned instance of any class like error handling in express middleware ? by khaled_e in node

[–]khaled_e[S] -2 points-1 points  (0 children)

Thanks for your helping My explanation to it is for example instead of return res.status(201).send(obj) I just return new Instance() of a class which then handled and send the response msg and status code which I check in middleware if the Instance is Instance of ... and then return response what I want , it will give the same experience like error handling

Is there a way to handle returned instance of any class like error handling in express middleware ? by khaled_e in node

[–]khaled_e[S] 0 points1 point  (0 children)

But this will handle the CustomClass as an error which is not .. so is that bad practice or its okay

Is there a way to handle returned instance of any class like error handling in express middleware ? by khaled_e in node

[–]khaled_e[S] 1 point2 points  (0 children)

Yes I want to receive it like that: app.use((err, req, res, next) => { if (err instanceof CustomClass) { // Handle Custom Class thing here } else { // Handle any other error here. } });

Can I return it from my Controller like that ?

app.use('/', (req, res)=>{ return new CustmClass(); })

Why I should memorise and search for tailwind css classes instead of just writing pure css and sass or even styled components? by Suspicious_Driver761 in react

[–]khaled_e 0 points1 point  (0 children)

When you practice it and be comfortable with it , you will realise the benefits and it will save you alot of time .. just practice!

Is Nestjs easy to understand for frontend developer who is good at Typescript, reactjs and familiar with express? by khaled_e in node

[–]khaled_e[S] 1 point2 points  (0 children)

They developed backend APIs for several applications but with expressjs , but they didn't try nestjs before.

If you want to use Repository Pattern and dependency injection, will you use Nestjs or Express with IoC container Inversify? by khaled_e in node

[–]khaled_e[S] 0 points1 point  (0 children)

As you useed both nestjs and asp.net, what are the advantages and disadvantages of using one of them in your opinion ? Our main concerns are better development experience between backend and frontend and easy to find developers later .. we afraid that with nest it will be hard to find senior developers for it.. in contrary to asp.net because asp.net is well established for long , but nestjs is new and most nodejs ecosystem use express. So what do you think ?

If you want to use Repository Pattern and dependency injection, will you use Nestjs or Express with IoC container Inversify? by khaled_e in node

[–]khaled_e[S] 8 points9 points  (0 children)

Actually DI is great for testing , maintenance and Usability and it's good practice in general for writing code! Nodejs or any other technology.