Closed JimOfLeisure closed 2 years ago
Ok, yeah, we can deploy the static site from api-submission/public as easily as we could frontend/ , and we could then even add a deploy-static
script using environment variables for secrets and hosting targets.
Come to think of it we'll probably have all the APIs in that one express server, too, and we can manage cacheability with headers when it comes to that.
The repo was refactored, and frontend is now under server/frontend and is conditionally static-served by express. Also, dev scripts are added for server/ .
see commit 9dc930afce2c00404324baa2f0e33a50f1c5be26
I currently plan for the completed site to have front end code and at least one API all appearing to be at the same domain and port. So we're going to need a build script to set up a dev server to handle that routing when testing locally.
I can think of a couple of possible ways, but a little research and experimentation may be needed.
On second thought, maybe it's as simple as moving the frontend to an
express.static()
folder inside the API and only enable the static folder ifprocess.env.PORT
is not present, meaning when running locally the static folder serves the frontend but when on Heroku or similar it does not.