mrk
Explore posts from serversHow to check if request to API endpoint is internal or external?
I have custom API endpoints under
/api
protected using nuxt-auth-utils
and a server middleware which uses requireUserSession()
for all routes under /api
. I wish to omit one of these routes from requiring a cookie (logged-in session) ONLY if the request is an internal request, that is, if it was made by either the server (nitro) or the client (nuxt). Is there a deterministic way of checking if a request is an internal request coming from within the app (nuxt and/or nitro)? I already searched through the nuxt, nitro and h3 docs and couldn't find anyting. I would also like to avoid using e.g. "Referer" header which is not 100% deterministic and still only comes from client requests5 replies
DTDrizzle Team
•Created by mrk on 5/24/2024 in #help
UPSERT operation not working for SQLite/Turso
Hey! So I'm trying to do a BULK UPSERT for multiple rows with a
.returning()
and its not working. I expect:
- UPDATE: rows which include the PKs "id"
- INSERT: rows which DO NOT include the PKs "id"
the code is as follows (I've followed the docs and tried some variants):
I would expect results being:
and I keep getting (the first row is unchanged / not updated):
Am I doing something wrong? Thanks! Any help is greatly appreciated!9 replies