CapacitorJS, Can not connect to local backend(Node.js) from Android App
14:58 13 Jun 2022

I'm developing a Vue.js + node.js(with MongoDB) web site and I also want to create an app for Android and IOS. Currently, I'm working on my local machine (localhost). I converted Vue.js code to Android with Capacitor.js. I tried running it on the emulator and on my physical phone, but the app can not request data from my local backend. My backend runs on port 3000 and I'm using the cors middleware like this:

const express = require("express");
const app = express();
app.use(
    cors({
        credentials: true,
        origin: (origin, callback) => {
            callback(null, true);
            },
    })
);

Everything works well on the web side. What should I do or what am I missing? The UI works well.

android node.js vue.js capacitor