Google App Engine Channels API / Loading external JS with React Native - require

I'm in the process of porting a project to React Native, previously i referenced an the google channels api from an external server for web sockets e.g. https://example.com/_ah/channel/jsapi.
Is there an elegant way I can reference this using React Native ?

Channels API is doomed, favour firebase or some standard websocket implementation in projects

Related

Is it possible to turn express server serving react frontend into desktop app using electron?

I have made a web app using express and react, and I want to bundle it into a desktop application, is this possible using electron?
I recommend the tutorial at: https://www.electronforge.io/guides/framework-integration/react
This isn't too hard actually, you can find all instructions you need in https://www.electronforge.io/
To accomplish this, either your app keeps hosting it with express locally and electrons connects to localhost, or even better, do it by not hosting any servers and just keeping your JSX and html files in your project.
If you're using TypeScript and ES6, also consider taking a look here for some examples: https://www.electronforge.io/templates/typescript-+-webpack-template

possibility of using NodeJs server-side codes in mobile application?

Is that possible to use NodeJs server-side codes in react native,ionic,cordova or native script for mobile applications?
Question update:
I want to use NodeJs package and include NodeJs package into mobile application (native script , ionic , cordova or react native). for example include instagram-private-api into native script : NodeJs Private instagram API
{N} !== Browser / NodeJS.
It's a pure JS runtime, any apis specific to these platforms won't work within {N}. Though nativescript-nodeify plugin on-boards very limited NodeJS apis by translating them to their native equivalents.
I've been using many node.js APIs (including google/baidu/bing/wikipedia) inside my cordova App, here's what I did:
Install node.js / express / socket.io in your linux server.
Use socket.io inside your Cordova app to create 'many clients to one server' connections between your app and the node.js/socket.io server. In https://socket.io there is a simple example teaching you how to do that.
In Cordova App, use something like socket.emit('FromClientToServerCallAPI', data) to call an api.
In node.js server, define a function:
socket.on('FromClientToServerCallAPI', data)
and inside this function, call your api, and after you got the result from the api provider, run:
socket.emit('FromServerToClientAPIResult', result)
In your Cordova App, define a function:
socket.on('FromServerToClientAPIResult', result)
then do somthing with 'result'
pls. note that all the functions above are async.
Never try to call the api directly in your client codes, Some api provider requires you to apply for the api service and give you a 'key' to use the api, you don't want to put this 'key' inside your javacript and disclose it to all your users of the App, right?
Yes, it is possible with nodejs-mobile. It lets you run a full-blown Node.js engine inside a mobile application. It works on Android and iOS. There are other solutions that work on Android but as far as I know nodejs-mobile is currently the only one that also supports iOS. It also comes with plugins for React Native and Cordova.
More information, including documentation, is available on the project website.
(Full disclosure: I work for the company that develops nodejs-mobile.)

Integrate Node.js with Angular 2 application

I am creating an angular 2 project which will use Node.Js as backEnd and Node.Js will make calls to 3rd party external APIS(Like Gandi) which accept calls only from Python, PHP or Node.Js.
I have chosen Node.Js.
I have called few APIs from Angular 2 services using HTTP protocol. Now I do not know where to write this Node.Js code and how to Integrate this Node.Js code with Angular 2 services.
I think, Just a sample application or sample architecture which is a combination of Node.Js and Angular 2 will help a lot.
Do I need to create Restful services using Node.Js?
If Yes, Do I need to use Express.Js also for server purpose?
Note: I do not want a Mean Stack application(No Mongo DB)
Actually it's pretty straightforward.
What I'd do is to simply consider the Angular 2 app on the frontend and the Node.Js API on the backend as independent projects. It's very likely that they will run on different providers (eg. Firebase for Angular 2 app and Heroku for the Node.js server) so it makes sense to handle them as 2 different projects with it's unique dependencies.
I have recently done a similar project, using Angular 2 + webpack as frontend and Django on the backend: https://github.com/damnko/angular2-django-movies
Hope this makes sense, otherwise please let me know
i think this repo will serve your purpose.
https://github.com/singh15/feed-server
which is using twitter api to get data and send that data to any front-end.

How does Express.js relate to Node JS?

I'm seeing several responses of comparisons of Express vs Node, what each is/does but still a little unclear how one relates to the other.
Wondering if this would be a good analogy?
JavaScript : jQuery = Node.js : Express.js
Node.js is a platform for building server-side event-driven i/o application using javascript.
Express.js is a framework that is based on node.js for building web-application
node.js is a Javascript runtime environment that comes with a ton of libraries.
Express is a Javascript library that runs in node.js and offers advanced features for configuring and running a web server.
So, you can have a web server in node.js without Express (the built-in http module offers a simple web server), but you cannot use Express without node.js since Express runs on top of node.js. Express adds many more features (such as routing and middleware and tons of compatible add-ons) over the built-in web server.
Your analogy of Browser Javascript ==> jQuery as compared to Node.js ==> Express is a good comparison. jQuery adds DOM manipulation features to regular browser Javascript while Express adds web server features to regular node.js web servers.

node.js server for ionic application

I am developing a mobile application using ionic framework. I want to use node.js for developing the server to make REST api calls.
Where should the node.js code be included in the project?
How to deploy such an app as apk? and how to test it?
Ionic is based on cordova and it is used to create mobile applications in javascript.
Node.js is based on V8 and it is used to create backend (server) applications in javascript.
Node.js code cannot run on mobiles.
So you have two seperate projects.One is the frontend ionic mobile app. And the second is the backend nodejs app.
To make a connection between the two, as ionic uses angularjs take a look at angular's http service. After that you can organize your code in services. For example:
http_calls_service.js or api_service.js
As for the testing there are several frameworks to work with. Take a look at this.

Resources