URL Shortener Project Review

URL Shortener Project Review
0.0 0

#1

This is the live app http://url-shortener-microservice-fcc-computerluca.c9users.io/
This is the code https://github.com/computerluca/url-shortener-microservice-fcc
Any comments! Also about the code!


#2

Your code looks good, but your app doesn’t seem to be up anymore.


#3

Now the website is up!


#4

Good job.

This isn’t necessary for an app of this size really, but a couple of things you can consider are:

  1. Minimize the frequency of your database connections. You currently open a db connection with every HTTP request which is a pretty slow way to approach it. You can rethink this so that you open the db connection once and then pass it around using ‘middleware’ (which is a very node-y concept).

  2. You can break up your code into modules for better ‘separation of concerns’. For example, you handle your server, database connection, routes, logic and views all in the same file. Obviously, when you only have 129 lines, that’s not a big deal, but for a bigger project, or many more routes it becomes pretty unmanageable.

  3. To help the separation of views from the rest of the code, you might like to use EJS or Jade/Pug for templates.


#5

Thank you for your precious suggestions!


#6

I migrated my project on hyperdev
https://denim-bat.hyperdev.space/