Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

APIs

Desmond Dallas
Desmond Dallas
6,985 Points

express - localhost

Hi hope someone can help. Im currently doing the express task. I have set up localhost on port 3000. Whenever I make a change to a file I i have to close the terminal and open it back up again to see changes on the file(page). This is getting quite tedious. Is there anyway I can config the terminal so I can do this more quickly with a simple command.

Also I have noticed that when I run the local host I cannot do any other command in the terminal. Im presuming I have to stop localhost. However I do not know how to stop localhost without closing and opening the terminal again...

Anyone can put me forward in the right direction please.

Adam Sommer
Adam Sommer
62,470 Points

For developing Node and Express applications I use nodemon. Nodemon will watch the files in the directory for changes and restart automatically. Basically use the ./node_modules/.bin/nodemon index.js instead of node index.js (or whatever the name of your application file is).

Also, you can hit Ctrl+c to stop a currently running process in a terminal. Use Ctrl+c to stop node and/or nodemon. You can also open more than one terminal at a time if you need to.

Another idea might be to work through the Console Foundations course.

2 Answers

Hi Desmond, You will definitely want to install and use nodemon. Here is a link to the package on npm. https://www.npmjs.com/package/nodemon basically nodemon will watch for file changes and restart the server in the background for you so that you can just refresh your browser after you make changes. Also you can open more than one terminal at a time. Just choose new window under the file or shell menu. Keep at it! Rachel