DEV Community

Discussion on: Senior front end dev here, ask me anything!

Collapse
 
thomasfaller profile image
Thomas Faller

Hi Rob,
I’m a junior dev, currently mostly working on backend things. At work we have a legacy API written in PHP. I’d like to rewrite that in Node. I’m lacking the conceptual, and structural knowledge to be efficient. I’ve read about the mvc model but I’m not sure how to implement it and where to start. Would you have any advice on that? Maybe a resource, book to read ? Thanks and take care!
Thomas

Collapse
 
kendalmintcode profile image
Rob Kendal {{☕}}

Ooo now that's a tough one. So, in essence, the MVC model is Model, View, Controller, where 'Model' is the data model or shape of the object that the 'Controller' (which usually accepts some sort of input or otherwise processes a request) provides to the 'View'.

In terms of structural stuff, I'd look to start small, with one aspect of the API and break it down into the component parts. So, what should the controller do when we hit something like '/users'? Then, if it should return a list of users, what should the data model of a 'user' look like? Take that approach and build on it. Starting is the hardest part, sometimes because the task seems enormous, partly because we want it perfect from the start.

Don't be afraid to ask for help internally for advice on that too. Ideally, you should have some senior devs who will be willing to help guide you and share their knowledge, especially if they've got working knowledge of the API you're dealing with too 😄

There's also a good article on Sitepoint that walks through building an MVC-based Node app that might give you some direction.