brillout / goldpage

Page Builder.
Creative Commons Zero v1.0 Universal
57 stars 3 forks source link

Have ssr.express function serve build artifacts inside .build directory without having to start server via command line #6

Closed chriscalo closed 5 years ago

chriscalo commented 5 years ago

One more idea that builds on #5. Again, feel free to discard if you disagree.

Assume the dev build is already running in watch mode, so a .build directory aleady exists and is being updated on each relevant change to pages/**/*.page.js. Or, assume the production build has already been run, so there's a static .build directory.

Could the ssr.express handler automatically look for build artifacts inside the .build directory and serve them when the request URL matches a route from one of the *.page.js files? It would be important to also call express's next() function when the request URL doesn't match any of the *.page.js routes so that later handlers can run for the same request.

(Not sure if I'm describing how things work today.)

This makes it so that Goldpage doesn't have to build my entire server and can instead only build everything inside of pages/**/*.page.js.

Thoughts?

brillout commented 5 years ago

Hi,

(Not sure if I'm describing how things work today.)

Yep that's how things work today.

This makes it so that Goldpage doesn't have to build my entire server and can instead only build everything inside of pages/*/.page.js.

This is the case when you run goldpage dev (instead of goldpage dev ./path/to/server.js) and goldpage build (instead of goldpage build ./path/to/server.js).

goldpage dev builds only your pages whereas goldpage dev ./path/to/server.js builds your pages and your server.

chriscalo commented 5 years ago

This is perfect. I now understand how things work and it feels like a pretty good match for the app I’m working on. Thanks again 🙏