Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exposing REST endpoints #704

Open
aureliusm opened this issue May 13, 2021 · 2 comments
Open

Exposing REST endpoints #704

aureliusm opened this issue May 13, 2021 · 2 comments
Labels
question Further information is requested

Comments

@aureliusm
Copy link

Hi,

this is more a question than an issue. I can't figure out how can I expose a rest api endpoint to my app. How can other apps on computer access an electron-nuxt app? I would like to make it possible that while my app is running, other system apps can access some endpoints.

Thanks for any possible helpers and thanks for a great package!

@michalzaq12 michalzaq12 added the question Further information is requested label May 17, 2021
@MuGi-131
Copy link

I've add serverMiddleware to nuxt.config.
On development it loads the API but it seems that when I build the project the API part is not packaged with it.

If you've figured out how to include it please, spare me some insight.

@M-Barari
Copy link

@aureliusm , @MuGi-131 , any solution?? I'm also using serverMiddleware to send /api endpoints through express handler so I can fetch data from my local DB by axios requests. It works on dev but not build!! the middleware itself is called as I logged but wont send to handler

import express from 'express'
const app = express()

app.use(express.json())

app.get(`/`, async (req, res) => {
    console.log('this is it');
    res.send('GOOD Job!!')
})
console.log('middleware');
export default {
  path: '/api',
  handler: app
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants