Jacek
How to build an SPA + Nitro for server with Nuxt
Preset value is actually
node_server
(not node-server
) and you don't need to put it in the config as it is the default.
Build the project into a Docker container or configure your hosting to run server/index.mjs
and you should be good to go.
Also consider alternative runtimes - Bun if you want to handle more users or Deno for built-in security.4 replies
Nuxt dev server from code server
Apologies, I through the error is related to your own use of WebSockets.
In case of HMR.. it should be there already. Maybe devServer » https could help force Vite to realize it is loaded with with TLS and switch to
wss://
.20 replies
Reusable websocket component
Dude.. don't listen to mr-generate-random-plausible-answer-from-noise. Use it for generating tests or something, but don't ask it for tech-related stuff, because it will spit lies from training data and you will never know how much truth is there until you dig the topic yourself.
49 replies
Reusable websocket component
What's ugly about it? in-memory KV acts like a queue, you can clear it anytime (even right before when you set the value). The system is then decoupled and queue technology can be swapped (from in-memory to something cloud-based). You can wrap set/watch/clear methods with a custom service API. The only alternative would be to share/leak
peer
instance on open so some service could call .publish(...)
anytime it thinks appropriate, while in real-world scenario you'd end up with an array of peer
s for all open connections and utilizing .send(...)
instead to avoid broadcasting to all chat rooms.
Ofc built-in solution would be preferrable, however it is always a trade - flexibility vs convenience 😉49 replies