#Node configuration

11 messages · Page 1 of 1 (latest)

desert pebble
#

astro node approach ¿standalone or middleware?
how can i configure the endpoints of the API and the server folder

strong coral
#

hi so if your just want to create api routes or run serverside code on a page, standalone mode is fine

#

but if you have a use case that is a bit more complex which you can't do in an api route or page, middleware mode allows you to bring a custom server

an example where this is useful is a long running process, like a websocket server

#

for example for me I'm using standalone mode, but I deploy my site in Docker, and astro's server doesn't process SIGINT signals in the container so I need to add a code snippet to process it.

But the problem is, AFAIK in standalone mode you can't edit the server directly, so I'd need to run in middleware mode and setup a custom server where I can process the SIGINT

desert pebble
#

and if i want to create an email service i need to add a middleware server or can i do it within my astro project?

desert pebble
#

it is possible with standalone configuration?

strong coral
#

you can do it with both

#

do you know what a "middleware" is?

dire charm
#

There are two-layers of middleware available.

#

One is a router middleware firing when you reach endpoints or pages in astro, that is the one that Murad linked.