NuxtN
Nuxt4y ago
10 replies
Fabian B.

Server API endpoints are slow

Hey there, I am currently looking to optimize the speed of my api routes, and in general, they are pretty slow, so I thought of removing everything. So basically, with everything removed, an empty api request still takes about 150ms, which I find extremely long. Here is the example code:

export default defineEventHandler(async event => {
    const startTime = +new Date()
    console.log(startTime, 'start')
    console.log(+new Date(), 'end', { took: +new Date() - startTime })
    return true
})


I push to vercel with no further config.

Does anyone else have the issue? Or is 150ms just acceptable for an api request? I rember setting up basic nodejs servers in the past that would do 10-20ms for (almost) empty requests.
Bildschirmfoto_2022-11-27_um_12.44.55.jpg
Was this page helpful?