Urigo / WhatsApp-Clone-Tutorial

https://www.tortilla.academy/Urigo/WhatsApp-Clone-Tutorial
https://tortilla.academy
565 stars 142 forks source link

[Server Step 1.1] - use ts-node-dev instead of ts-node #4

Open sfabriece opened 5 years ago

sfabriece commented 5 years ago

with ts-node-dev, you get a watch mode that restarts the server when a file is changed

jonsnielsen commented 5 years ago

I second that! It works great, but by default it shows a notification in the OS window which can be really annoying. The flag --notify=false disables that however. My start script: "start": "ts-node-dev --notify=false index.ts"

Urigo commented 5 years ago

Thank you both for the suggestion!

It's actually something @kamilkisiela is in the process of doing!

He created a deep analysis of all the different ways to run GraphQL and Node on the backend together with performance benchmarks across all of our clients, which some of them have really huge codebases.

He will create a blog post about that and upgrade as the same time the tutorial together with all of our clients. He is now on a well needed and deserved vacation and will get to doing that after he will return.

jeriscc commented 5 years ago

Hey! Seems like the official documentation hasn't yet added scripts for hot-reloading. Here's something that I did on my end: I installed nodemon. Then, I added the following nodemon.json file

{
  "watch": ["."],
  "ext": "ts",
  "ignore": ["node_modules"],
  "exec": "ts-node ./index.ts"
}

along with a new script

"scripts": {
   ...
    "start:dev": "nodemon",
  }

This basically enables server-side hot reloading without changing much of the libraries present in the guide. Also, I wasn't sure how to contribute to the guide itself on this. Perhaps a contribution guide would help make this course more maintainable.