Questions tagged [servermiddleware]
9 questions
4
votes
2 answers
serverMiddleware access Nuxt instance or context
im trying to access Nuxt runtime variables from a serverMiddleware
Example i have this context.$db which i added from this plugin
nuxt.config.js:
plugins: [
{ src: '~/plugins/db_runtime.js', mode: 'server' }
…

Renato La Laina
- 41
- 2
- 3
1
vote
1 answer
Allowed hosts for serverMiddleware
I have built a NUXT app, and I've added to it a serverMiddleware for handling some REST endpoints and connecting to my database.
serverMiddleware: [
{ path: "/api", handler: "~/api/index.js" },
],
So my question is: How to restrict accessing to…

SIHEM BOUHENNICHE
- 388
- 2
- 10
1
vote
0 answers
Nuxt: ServerMiddleware should expose a handle undefined
I am registering a serverMiddleware using a custom module like this in module.js file
const middleware = require('./utils');
this.nuxt.hook('render:setupMiddleware', app => {
this.addServerMiddleware(middleware(app));
})
Here…

user3531900
- 311
- 4
- 13
1
vote
0 answers
Nuxt ServerMiddleware Returning HTML Doc
I am building out a webpage which needs to make a call to the Google Geocoder api.
In order to hide the api key from public view, I am trying to set up server middleware to act as a REST api endpoint.
I have checked through all of the documentation…

Brad Chandler
- 45
- 7
1
vote
1 answer
How to access privateRuntimeConfig declared in Nuxt.config.js in serverMiddleware?
How to access configuration declared in privateRuntimeConfig in Nuxt.config.js file in serverMiddleware?
$config and context are not available in serverMiddleware.
I am using serverMiddleware in Nuxtjs to write api.
Its getting called however I am…

user859375
- 3,529
- 5
- 21
- 22
0
votes
1 answer
Failed to load resource: net::ERR_BLOCKED_BY_CLIENT when trying to use the NuxtJS api
I am using NuxtJS 2, I deployed my app on Vercel and everything has been working fine. The things changed when I decided to add serverMiddleware, I created a api folder, I added the following to the nuxt.config.js file:
serverMiddleware: [{
path:…

Vivallo04
- 24
- 3
0
votes
0 answers
Fetching external data in a Nuxt2 serverMiddleware
This should be very simple, but it's turning out to be frustratingly tricky. I have an external server running that exposes an API endpoint. I need to call that API endpoint from a serverMiddleware (that is using express, btw) of a Nuxt2 app. I…

Nayeemul Islam Swad
- 157
- 8
0
votes
0 answers
Unexpected field ERROR in multer file upload
I'm setting up a server to run my project and using multer on the backend. However, whenever I try to send an image from my frontend to the backend, i get message: "Unexpected field", name: "MulterError", frames.
dependencies that i'm using in my…

marjan
- 97
- 7
-2
votes
1 answer
How to send a file via axios to an external api using node js
I am new to node js and i am developing the server-side of my nuxt project.
actually i want to send a file to an external api but i get error Callback must be a function
in my server.js
let formidable = require('formidable');
const bodyParser =…

marjan
- 97
- 7