react-expressjs icon indicating copy to clipboard operation
react-expressjs copied to clipboard

server.dev.js

Open vegtelenseg opened this issue 6 years ago • 8 comments

Hi,

Would you please illustrate how one would implement a development version of the production server? I am trying to write functionality that will be handled by the server at runtime, but it's impossible to hit the server since it is not part of the dev environment.

Thanks

Siya

vegtelenseg avatar Sep 28 '17 10:09 vegtelenseg

Sorry I totally forgot about this issue. Do you still need any help with it?

tahnik avatar Oct 21 '17 15:10 tahnik

Yes, yes, I still do. Please help.

vegtelenseg avatar Nov 02 '17 09:11 vegtelenseg

If I understand your question correctly, you could just build the server and use

node ./server/bin/server.js

This would open the server at localhost:3000.

tahnik avatar Nov 06 '17 00:11 tahnik

I would like to run the server in dev mode. At the moment, when I run npm run dev it does not include the server as part of the program, as a result, If I make any http request to it I get nothing in return. I want to be able to query the server in development mode. That is when I run npm run dev

vegtelenseg avatar Nov 06 '17 10:11 vegtelenseg

@Siyanda-Mzam Hm you're right. Do you have time for a pull request? I don't think I will be able to work on it very soon.

tahnik avatar Nov 07 '17 17:11 tahnik

@Siyanda-Mzam another thing you could do just to get some response from your server, you could run

npm run dev

in one terminal and

npm start

in another terminal. That might work too?

tahnik avatar Nov 07 '17 17:11 tahnik

I will work on it and PR. But I am also not sure if I can work on it immediately. Running npm run dev and npm start in separate terminals will work but will be counterproductive because everytime you need a change in the server, you will have to stop it, make the change, build it and run it again. So I think having a dedicated dev server is going to be much better.

vegtelenseg avatar Nov 08 '17 04:11 vegtelenseg

+1 for a dev version of the express server with Hotloading etc. :)

glomotion avatar May 28 '18 00:05 glomotion