This implementation is still fairly experimental, but we hope it is useful!
$ npm install
to install dependencies. Then, if your Mavo site is in the folder
/path/to/your/site, you can run the simplest server like this:
$ node server.js serve /path/to/your/site
Then visit the SSR server that's printed in your browser. This server will render every page in headless Chrome before serving it.
You can pass in a directory where the server will cache rendered versions of any requested pages in with the option
$ node server.js serve /path/to/your/site --cache mycache
Then, as requests come in,
mavo-ssr will cache any responses it serves as plain HTML files in the
mycache directory, and will serve files from the cache instead of rerendering them. (The cache is currently never invalidated, but we hope to add this feature some day.)
If you want, you can serve your website primarily through
mavo-ssr just by running
server.js as described above and specifying a port number with
--port, although this is not recommended for production use since it's just running an extremely simple express.js server. You can also use
mavo-ssr as a prerendering tool by serving with a cache, then just manually visiting each page in your site and statically serving the files that were output into the cache directory instead.
Other settings are described if you run
node server.js or
node server.js serve --help.