Closed bgonz closed 6 years ago
I am not too sure I get much of this. But I am running node.js apps in Lando, with npm run dev
, where our dev
command looks like this:
nodemon src/index.js --watch src --exec babel-node -e js,graphql --ignore *.test.js
Changing the code, reloads the app.
Is this what we're talking about? :D
yup
On Tue, Mar 27, 2018 at 1:36 AM, Vincenzo Russo notifications@github.com wrote:
I am not too sure I get much of this. But I am running node.js apps in Lando, with npm run dev, where our dev command looks like this:
nodemon src/index.js --watch src --exec babel-node -e js,graphql --ignore *.test.js
Changing the code, reloads the app.
Is this what we're talking about? :D
— You are receiving this because you were assigned. Reply to this email directly, view it on GitHub https://github.com/lando/lando/issues/801#issuecomment-376442545, or mute the thread https://github.com/notifications/unsubscribe-auth/AAri0KnFIFqKfLCbb8alIy-PWiDdwLHMks5tifoBgaJpZM4S13lY .
@bgonz so the mean
example already has some autoreload baked into it but all this needs to be set up on the user side of things. We are using nodemon
as pointed out by @vincenzo above so you'll probably want pass in arguments that make sense for your use case.
Going to update the express
example to use nodemon
as well so at least there is a very basic example of this working for people to follow.
Feature Request / Guidance
As a lando user who wants to begin developing Node.js + Express apps locally, I would like a way to have the browser reflect my recent file changes.
I used the Example -> https://github.com/lando/lando/tree/master/examples/express
I made an edit to the "app.js" in my local file system -> I can see it made the change to the Docker Container -> 'lando ssh appserver' -> cat app.js ... "I said "Oh my!" What a marvelous tune! Bingo Bango Bongo Baby!" (as edited on my local file system)
But refreshing the Browser does not seem to update the message. What am I missing? The only way I can get the browser to reflect the changes is to 'lando restart' which is unpleasant to do for quick iterative changes. Outside of Lando - I have had success with using PM2 (http://pm2.keymetrics.io/) with my Node.js + Express app.
It would be awesome if the Express Example had a prebuilt tool for monitoring for changes.
@dustinleblanc - mentioned possibly using Webpack for HotReloading @serundeputy - mentioned
npm
script in the app likebuild
or something; then you can dolando npm build
and it will rebuild the served app on changes, but you have to get that or write it.I tried doing a simple 'npm start' and the equivalent 'node app.js' but both seem to fail.
If it helps at all - here is what I use for just a normal Docker setup using Docker Compose:
-- /node-app/Dockerfile