DEV Community

Discussion on: Build a Todo App with Node.Js, ExpressJs, MongoDB and VueJs – Part 1

Collapse
 
hvdrew profile image
Andrew • Edited

Howdy.

Great job on the article! I thought I would make a few suggestions just in case they haven't been made:

  • Try to stay consistent with your error handling, there are different styles written all throughout this first part of the tutorial (you use err, then error, then err again). Keeping parameter names consistent and sticking to one particular pattern can help with readability and is in general a good practice.
  • If you are going to use an if/else in one route handler, consider using it in all. If you would rather stick to if/return patterns, do that instead. Just stay consistent!
  • The console.log after using app.listen could have been passed as a callback.
  • const and let would have both come in handy all throughout this project.
  • The route for the Index.html file is redundant. After setting the express.static directory you have already prepared it to serve that file on the root route.
  • It's probably easier for your readers if you group require statements by their type. For example, group all 3rd party dependencies, then group all file dependencies from your project, then start declaring things like the app instance. This makes it easier to follow for your readers.

Other than that the article was on point, great work. Best of luck to you!