Use Nuxt with Express.js instead of nitro
Hello everyone, I really need some help I dont know how many hours I have spent on this simple task and yet I can not fix it.
I want to use nuxt with express.js for the back instead of nitro but I want of course to keep nuxt's auto routing for the front end.
I have made a project , added this to nuxt.config.ts
export default defineNuxtConfig({
ssr: false,
compatibilityDate: '2025-05-15',
devtools: { enabled: true },
serverHandlers: [
{
route: '/api/express',
handler: '~~/middleware-express-js/app.ts',
middleware: true
}
]
})
But I am getting this error
" [unhandledRejection] read ECONNRESET
at TCP.onStreamRead (node:internal/stream_base_commons:216:20)"
Is this even the correct way to use express with nitro?
This is an example fetch:
And this is an example post I am using:
I want to use nuxt with express.js for the back instead of nitro but I want of course to keep nuxt's auto routing for the front end.
I have made a project , added this to nuxt.config.ts
export default defineNuxtConfig({
ssr: false,
compatibilityDate: '2025-05-15',
devtools: { enabled: true },
serverHandlers: [
{
route: '/api/express',
handler: '~~/middleware-express-js/app.ts',
middleware: true
}
]
})
But I am getting this error
" [unhandledRejection] read ECONNRESET
at TCP.onStreamRead (node:internal/stream_base_commons:216:20)"
Is this even the correct way to use express with nitro?
This is an example fetch:
<template>
<div>
This is the template index.vue file.
</div>
<div>
{{ expressData }}
</div>
</template>
<script setup lang="ts">
const { data: expressData } = await useFetch("/api/express");
</script>
And this is an example post I am using:
<template>
<div>
Template add-product.vue page.
</div>
<form action="/api/express/product" method="POST">
<div>
<input type="text" name="title">
</div>
<button type="submit">Add Product</button>
</form>
</template>
<script setup>
</script>
