Closed jho406 closed 5 months ago
yes, both of those are good ideas for a serve side renderer.
Depending if you're using a forking web server, you also need to be careful around forking, see https://github.com/rubyjs/mini_racer#fork-safety.
Thanks @tisba! Agreed. I'm assuming most projects would be using Puma which forks in clustered mode. I had taken those instructions and added an example on how to work with puma.
# Puma
on_worker_boot do
Humid.create_context # Calls MiniRacer::Context.new
end
on_worker_shutdown do
Humid.dispose # disposes of the mini_racer context via `dispose`
end
Does that feel like a good enough start?
Thanks everyone for all the suggestions. I'll close this Issue and make changes over at Humid.
Hi! I recently built Humid, a very light wrapper around
mini_racer
to make server side rendering easier to setup for JS projects with Rails/Puma. I was wondering if ya'll would be able to recommend some defaults for options passed toMiniRacer::Context.new
. Right now, i have that set as empty, but am recommendingin my README. I'm also open to any suggestions or feedback on the project if any.
Thanks for the wonderful library!