Sign in
Log inSign up

Best practice when creating client and server NodeJS?

xahovuzu's photo
xahovuzu
·Aug 24, 2018

I created a client and server folder, the server will serve the static and bundled (webpack) files from the client (using ReactJS) and also will have an API, I was wondering, is it wrong or not recommended to have only one package.json for both client and server or it's better to have separeted, like this:

1:

  • package.json:
  • client
  • server

2:

  • client:
    • package.json
  • server
    • package.json

The only way I know how to deploy a NodeJs app is like this where Express will serve the static file and also have the API routes. I don't know if it's possible to have two separated severs, one for the API and another one for the client. Any ideas?