DEV Community

Cover image for I'm a professional React developer, and here's how I set up Node.js/GraphQL Microservices with Docker and React. #4
Better Coding Academy
Better Coding Academy

Posted on • Updated on

 

I'm a professional React developer, and here's how I set up Node.js/GraphQL Microservices with Docker and React. #4

Update: Part 5 is out!

About Me: I've been a professional web developer for just over 10 years now. I'm currently the lead web development instructor at Better Coding Academy, and as part of what I do, I post videos on our YouTube channel at https://www.youtube.com/c/BetterCodingAcademy.

(Subscribe for awesome web development content!)

This is part 4 in a full tutorial on how to set up a React/Node.js app with a microservices architecture. (Here's part 3!)

In this video, I hook up the Listings and Users microservices to the GraphQL-powered API gateway, in preparation for use within the React app.

I hope you enjoy!

Happy coding!

Full source code: https://github.com/parkroolucas/microservices-demo

Top comments (27)

Collapse
 
devdrake0 profile image
Si

You've made yourself look like a twat, congratulations.

If your first reaction, to somebody creating a learning resource, is to put them down you should just stay quiet.

I notice your history shows one comment, and zero submissions of helpful articles, so sit down and shut up.

Collapse
 
jenc profile image
Jen Chan

Yeah I notice a bunch of accounts like that lately with a snarky sock puppet stack overflow vibe. Huh.

Collapse
 
bettercodingacademy profile image
Better Coding Academy • Edited

Hi Mahen, thanks for your feedback! Let me try and answer this best I can:

try catch in every route handler instead of a centralized way to handle errors in express middleware

As far as I know (and I'm willing to admit I might be wrong here), Express does not provide a better way to handle errors raised in asynchronous operations - see the Express docs on error handling for more information on this. Notice that it says:

If the try...catch block were omitted, Express would not catch the error since it is not part of the synchronous handler code.

I also notice that there is no general way included to validate incoming data for the API endpoints (by using Joi validation for example)

Correct. I stated in the video (not sure which one lol but at least one of them in the series :P) that I took and will take quite a few shortcuts in order to best showcase microservices in this video series and not add too much fluff. I personally use Joi for validation with a custom middleware, but that's not something I felt was necessary to showcase microservices within this video.

The business logic currently resides within the express route handlers. What are your experiences with reusability of business logic when using this style of coding?

I don't see any need to put the business logic elsewhere. The Users and Listings microservices are designed as simple REST wrappers on top of a database, so I would argue that this sort of design is not only intentional but optimal.

Hope this helps!

Collapse
 
stephenthecurt profile image
Stephen Curtis

I don't mean to be that guy. But, wouldn't you expect anyone writing an article on how to do something to be a professional?

Collapse
 
devdrake0 profile image
Si

Definitely not. I blogged a lot when I was just starting out in development.

Collapse
 
stephenthecurt profile image
Stephen Curtis

That's kind of the point I'm making here.

Thread Thread
 
devdrake0 profile image
Si

A lot of people blog for themselves, as a way of cementing their understanding, and plenty of beginners relate to those types of articles as they are naturally not overly technical.

If any junior asks me what they can do, I always suggest blogging.

Thread Thread
 
stephenthecurt profile image
Stephen Curtis

I know and understand why they do it. But what I've been noticing over the years is a groundswell of bad practice, misunderstanding and issues that stem from the prevalence and dominance of articles written by novices for novices. It's starting to get to the point where it does more harm than good.

Thread Thread
 
jenc profile image
Jen Chan

I'm one of those who are guilty of both but have a few years under me and continue to blog! We all start somewhere and I'm really happy when the community corrects me. Unfortunately without ongoing mentorship between short jobs and no school I don't have the direction on right or wrong, and reading and chatting on the internet is the substitute. I think like anything, a range of sources are important in self study, and being humble and ready to acknowledge errors in thinking is super important.

Thread Thread
 
devdrake0 profile image
Si

I understand the point you're trying to make Stephen, but at the same time I'd never advocate learning solely through blogs.

My point of view is blogging is informal, and isn't designed to "teach" people everything. Naturally, a blog post focuses of something very specific.

Readers should read posts, and will probably learn something from them, but I'd always recommend for people to read from official sources afterwards.

 
bettercodingacademy profile image
Better Coding Academy

That seems really cool! Thanks for your advice, will consider that in the future :)

Collapse
 
bettercodingacademy profile image
Better Coding Academy

Every Tom Dick and Harry is publishing articles claiming to be professional developer

Good thing my name is Lucas then!

Collapse
 
jenc profile image
Jen Chan

The experience of being told to shut up or think of the best question/answer on coding forums is entirely formative to my initial impression of tech being full of autodidactic genius-level, emotionally stunted and snobby people programming alone in caves and also partly why it took 2 years for me to decide to switch into tech πŸ˜‚.

It wasn't until I discovered different communities that I didn't feel this way and have come to understand that to be one school of (rather toxic) thought.

Collapse
 
devdrake0 profile image
Si

I'd ignore him, his history shows he has contributed nothing helpful so probably just jealous.

Carry on creating stuff!

Collapse
 
krzysztofczaplejewicz profile image
Krzysztof Czaplejewicz

Will it cover multiple react apps? And topics like a code splitting etc?

 
jenc profile image
Jen Chan

I'm not a guy πŸ˜‚

Thread Thread
 
devdrake0 profile image
Si

Unfortunately, with the growth of Dev, it is going to attract certain people who are simply toxic to the culture and only want to troll instead of actually contributing.

Thread Thread
 
devdrake0 profile image
Si

I wonder if @ben has any thoughts on how to combat this behaviour?

βš‘οΈβ›“JavaScript Visualized: Scope

async await

☝️ Check out this all-time classic DEV post