2

I have a version of the api server running locally. In the react-native app, I've pointed the BASEURL from the remote server, to my local address. From there, I start the server via

node .

Even though I'm able to login/create a new account, I noticed that all of the data from the new account that I created is only saved on the remote version of the db, not the local version. If my BASEURL is pointed at my local address and no longer to the remote server, how is it that the new Account data is ending up on the remote db and not the local one?

here is the server stack info -Server OS - Ubuntu 16.04

-Web Server - NGINX

-Server Application - Loopback.js and PM2

-Database - MariaDB

I'm also running a local version of mysql via mysql.server start.

here's what I have in my config.js file

export const SERVERCONFIG = {
    BASEURL: 'http://192.000.0.0:3000',
    // BASEURL: 'https://app.someapp.com',
    HEADERS: {
        'Accept': 'application/json',
        'Content-Type': 'application/json'
    },
    TIMEOUT_DURATION: 30000,
};

on the api server my datasources.json file:

{
  "db": {
    "name": "db",
    "connector": "memory"
  },
  "mysql": {
    "host": "xx.xxx.xxx.xx",
    "port": 3306,
    "url": "",
    "database": "somedb",
    "password": "somepassword",
    "name": "mysql",
    "user": "root",
    "connector": "mysql"
  }
}

my datasources.localdev.json looks like this

{
    "db": {
        "name": "db",
        "connector": "memory"
    },
    "mysql": {
        "host": "XXX.XXX.X.X",
        "port": 3306,
        "url": "",
        "database": "somedb",
        "password": "somepassword",
        "name": "mysql",
        "user": "root",
        "connector": "mysql"
    }
}

do I need to change something in my api server files?

VK1
  • 1,676
  • 4
  • 28
  • 51

1 Answers1

0

Rename datasources.localdev.json to datasources.local.js or just datasources.json and restart the server.

Antonio Trapani
  • 731
  • 5
  • 9