Where is the Server Side Entry Point?
I'd like to know where the server side is started so I can implement Bugsnag and database setup. This is for a nodeJS/Docker project.
17 Replies
foreign-sapphire•7mo ago
there is no defined serverside entry point. it's a thing we are currently evaluating how to do best.
so your input would be valuable.
when you say "serverside entry point", what exactly does this mean for you?
SSR? server functions? both ?
flat-fuchsia•7mo ago
That's a pretty interesting question. I also run NodeJS apps in docker containers. It might be easier to think of it in terms of goals. For me, thats mostly initialization of globals.. the place to setup a postgresql 'connection pool' . or a nats connection to pick up and react to events. or a place to initialize and maintain a set of authenticated users for websockets. (eek does TanStack Start support websockets?)
foreign-sapphire•7mo ago
nitro does support websockets
flat-fuchsia•7mo ago
zodding in and parsing in the environmental variables is also a good initial thing.. these are probably things you'd solve differently in a cloudflare workers style environment.. but
where to setup long running infrastructure code/data I guess is the question. i wonder if nitro has a bootstrap to harness
@Manuel Schiller this appears to be a limitation of nitro itself. As it appears to have no startup methods to latch onto (possibly by design)
foreign-sapphire•7mo ago
should be possible via nitro plugin? https://nitro.build/guide/plugins
Plugins - Nitro
Use plugins to extend Nitro's runtime behavior.
flat-fuchsia•7mo ago
actually, i just spotted that..
genetic-orangeOP•7mo ago
@Manuel Schiller Can you import or use defineNitroPlugin in Tanstack/start?
foreign-sapphire•7mo ago
flat-fuchsia•7mo ago
interesting. tho I wonder if its possible to wrap CreateStartHandler in the SSR handler.. or if SSR handler is the wrong place for code like this
appears to be wrong, doesnt run on startup
quickest-silver•7mo ago
I'm also trying to figure this out. For this config:
I am getting this error:
Package import specifier "#nitro-internal-virtual/error-handler" is not defined in package
.
And the env-check.ts
:
What do you think about this, @Manuel Schiller?foreign-sapphire•7mo ago
no idea, never tried this
might be caused by the setup through vinxi maybe?
since we are currently removing vinxi, we wont investigate this now as it will be gone soon
flat-fuchsia•7mo ago
vinxi is a vike competitor?
foreign-sapphire•7mo ago
not sure if that is comparable
flat-fuchsia•7mo ago
not very famliar with either. checking it out
national-gold•7mo ago
where do we add Cors. Is there a way to do createRouter( ({method:use})=>(cors() )
or do we add it as a global middleware
if you're actively removing vinxi 1.0 most be close
conscious-sapphire•7mo ago
Last time I checked (January) source code of Vinxi did not register nitro stuff like tasks or hooks
foreign-sapphire•7mo ago
we might be able to expose this in future