How to sync react native app with express app? - node.js

I am using react native android app for recording calls.Once the call get recorded, it should be uploaded to serer(express js and mysql) with call details.Suppose the app is in offline the file should uploaded to server whenever the app comes to online.How should i acheive this.
NOTE: All the above mentioned process should be run in background.
I found some solutions like pouchdb. For react native (pouchdb-react-native) npm and for express js (express-pouchdb) using this npm can i achive the sync? and how?

It is possible - using PouchDb server and LevelUp - to sync PouchDb with different backend databases. See this answer for details and the Nolan Lawson article on LevelUp.

Related

How to LInk Backend(Node.js) to front-End(React)

I am starting out on React.js after learning Node.js using Express. But I don't know How to Link my Backend App to front end React files? Can someone provide me a simple solution to the problem
You can begin with this steps, you got a thousands of topics about to make a complete and solid infrastructure:
Initialise your node.js server with port, cors (if you need)
Learn how express work with node.js and create your first route
Initialize your react project with or without npx create-react-app
Create your first frontend component and fetch data from your API
Link : https://www.freecodecamp.org/news/create-a-react-frontend-a-node-express-backend-and-connect-them-together-c5798926047c/

How to connect NodeJS with ReactJS front-end

I am new to reactJS. I am working on project which uses following :
Front-end : ReactJS
Backend : NodeJS (Express)
Front-end runs on port 3000
Back-end runs on port 8088.
I am planning to deploy application on amazon AWS.
What i am trying to do is load reactJS front-end when i make request on http://localhost:8088/
I know using axios we can make request on backend server and display fetched data.
What would be standard way of loading ReactJS front from the nodeJS ?
I'm not sure if this is the answer you are looking for, but generally in development you use something called proxy in your package.json in the client (react) folder:
{
// Other stuff
"proxy": "http://localhost:8088"
}
and then when you'd want to deploy you'd run npm build for your react folder and serve that generated folder called build. But as I said, you usually do that only when deploying your application onto server, not the actual development.
Also I'd suggest checking some of these videos, that are focused on deployment, because that is what I think you are asking, right ?

NodeJS express rest API APP into angular 5 project

I am new in programmation and i follow a tutorial in udemy to create my restful API with express JS.
I have almost finished my API and i want to integrate it in a new angular 5/6 project.
I have tried a lot of tutorials but i cannot launch my express project in an angular project to make a request with postman.
could you show me please ?
Here is my express project
You don't really need to "integrate" your NodeJs app with an Angular application.
You make a NodeJS REST API as you would with any other technology and run it separately on a certain port (Default is 3000 for NodeJS)
Run it with the command node app.js.
Then you make an Angular application, that connects to your API as if it would to any other page. A HTTP call inside a service to your specified link.
public contactAPI(){
var uri = 'localhost:3000'; //Or whatever the link is for your node server
return this.http.get(uri);
}

How to disable users from being able to view app through regular browsers in express / electron app

I have an express server that serves my angular front end at http://localhost:9000
I'm using electron as a desktop client.
I want to force users to view the application through electron and only through electron. I don't want users to have the ability to browser the application through any other browser.
Is there any way to disable the ability to access the app through a regular browser?
I've attempted to find information regarding this but have come up short.
EDIT: This can only be done on the client side
You can check if the window.process object exists.
if (window.process && window.process !== undefined) {
// Likely electron
}
I don't know if it's related, but is it possible for you not to use localhost? I found that after building angular parts (with ng run build) and referencing them in electron's main.js there was no need for local server to be running (but so far I only stuffed angular's quickstart into electron shell)

Node.js + Angular = Uncaught ReferenceError: require is not defined

I'm creating an Express.js API on a Node.js server. The API is used to access data stored on the server. I also keep a log of who's accessing the API in a database.
I'm trying to create an admin section that will use Angular.js to display the admin access logs neatly. I used the Angular Express Bootstrap seed to start my project:
https://github.com/jimakker/angular-express-bootstrap-seed/
My problem is that I need the controllers.js to access node modules but it doesn't seem to know that node exists. Here is my error:
controller.js
var mongo = require('mongodb');
[Uncaught ReferenceError: require is not defined]
How can I use node modules in Angular.js files?
Node is a server side technology, you would not typically use your node modules on the browser with Angular.js. However, if you want commonjs require functionality in the browser see: https://github.com/substack/node-browserify.
Ofcourse, a browser can't talk to mongodb directly which is why you need an API in the first place, angular would communicate with your API using HTTP.
Angular.js makes an $http call to Node.js which requires and talks to the mongodb.

Resources