#Pathname prefix in serve()
1 messages · Page 1 of 1 (latest)
let { pathname } = new URL(request.url);
if (pathname.includes('/api')) {
//do something with api
}
thanks, but in handler function for serve, is it possible to not return any response?
I don't think so, but you could just send an empty or custom response.
why would you not send a response
if no response was sent back the client would just be left hanging but with an open tcp connection
I'm creating simple api using std that would run alongside with my page made in deno fresh. I thoguht that calling 404 response from api would interfere with fresh pages? Not sure about that so i may be just wrong. thanks for the answers tho 
Fresh handles apis very effectively. Just use Fresh. Let me know if you need an example.