tahnik / react-expressjs

Simple and compact boilerplate for ReactJS project with expressJS
MIT License
212 stars 73 forks source link

server.dev.js #4

Open vegtelenseg opened 7 years ago

vegtelenseg commented 7 years ago

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

tahnik commented 6 years ago

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

vegtelenseg commented 6 years ago

Yes, yes, I still do. Please help.

tahnik commented 6 years ago

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.

vegtelenseg commented 6 years ago

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

tahnik commented 6 years ago

@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 commented 6 years ago

@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?

vegtelenseg commented 6 years ago

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.

glomotion commented 6 years ago

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