There is a mode to run a nodejs backend on android? - javascript

I will try to explain better, I made a NodeJS backend with integrated react UI that call localhost for local API/function integrated in NodeJS. Is there a way to make a porting of this solution to an APK? For now the only way to make NodeJS works on android is manually or with obsolete library like Androidjs

Yes we can use Node.js using Termux however it is not quite recommended to run a backend server on Android.

There is an Library. You can check nodejs-mobile. If you want Node.js in root process can you check Magisk Node.js

The right answer after some research is the comment of Norman Breau
"Android is kind of a closed system. Unless you root your device, normal app processes don't have direct access to many OS/system APIs. This I suspect would be a problem even if you could compile Node and natively link it against your app."

Related

How to run a JS application on desktop and call C code?

I have an web app (WebGL/HTML5/JS) that is very computationally demanding. I want to turn this into a desktop app. I have heard of app.js, http://appjs.com but the problem here will be WebGL ?
The reason I want to turn it into a desktop app is because I want to call unix system commands.
Thanks
Electron would probably be a better choice since it is still actively maintained and AppJS is not. Electron is Chromium based so it supports WebGL. Here is an example of using WebGL with Electron.
NW.js is a similar project. There are some technical reasons that you might want to prefer Electron over NW.js.
Both give you access to Node, so you should be able to call system commands using the child process module.

Network Service Discovery (mDNS) on react-native/Expo

I have an IOT device ruining a mDNS responder, is there a way to find the device through a react-native/Expo app?
I have found a react-native library (react-native-zeroconf). However, it requires react-native-link which expo does not support.
I have also found a pure Java Script library (multicast-dns). However, I'm not sure whether it is possible to port that to react-native/Expo.
Should I detach and use native modules? I'm keeping that as a last resort for now.
The first one you can do with expo but you will need to detach.
The second will not work at all because it assumes the node API which does not exist in ReactNative.

Cordova web server with configurable responses

Is there any way to set up a local web server in a Cordova application such that I can control the responses via Javascript? I'm currently developing a custom plugin that communicates with a remote system via HTTP. I'd like to be able to run integration tests on this that are written in the Javascript code of a Cordova application, so I can easily test them in all supported platforms (Android, iOS, and ideally in the browser too... although the latter seems a little unlikely to be possible), but this means I need to be able to set up mock API responses from javascript code ... which will require the presence of a mock server that the plugin can communicate with.
I'm familiar with this plugin, but it can only respond using files in the local system -- I want to be able to generate responses and capture sent POST data in a Javascript callback. Is there any existing way of doing this?
Having searched extensively, I came to the conclusion that no such plugin exists.
I have therefore started an implementation of such a plugin myself: the initial version is now available on NPM and GitHub, with a sample project available in the github repository.
Android support is currently functioning, and I intended to start on iOS support in the next few days.
(Updated to add: unfortunately the project I was working on was cancelled, so have not had time supported by my employer to finish the iOS version, and as I don't have a mac personally so can't work on this on my own time, this seems unlikely to happen in the near future, but if anyone else needs it, it should be relatively simple to add the iOS version)

Electron UI for Golang Program?

I'd like to make a GUI in Electron for a Desktop Application written in Go (currently it's a command line tool).
What's the convention for communicating between the Electron and Go processes?
Would simply using the Go binary as an API work? Some sort of websocket communication?
You can use go-astilectron it allows you to build cross-platform GUI apps with GO and HTML/JS/CSS (powered by Electron) (disclosure: I'm the author)
The interaction of an application written in electron with its backend is exactly like a Web browser, therefore you have the same options (Web Api, Web Sockets, Ajax, etc.)
You can execute your command line app from your Electron app via child_process.spawn and communicate with it via stdin/stdout.
Murlock
Is an Electron wrapper for Golang to make it easy for this kind of app for Mac. They're working on Windows and looking for contributions for the other platforms.
Similarly to Murlock, may I dare to suggest Webview library. It's a thin wrapper over Webkit and MSHTML that runs on Windows 7+, MacOS, Linux and OpenBSD.
It is much smaller and easier than Electron. Also the resulting apps are smaller and less memory-hungry.
You may have a look at https://github.com/zserge/webview/tree/master/examples/todo-go for a Todo app example that compiles into a small standalone binary.
I've been looking exactly on how to run ElectronJS backend with Go to build a native desktop application.
you can use extraResources with process.resourcesPath variable to get into the Resources folder. and execute your binary. its not very recommended though.
Other option to use: https://github.com/wailsapp/wails
Its very lightweight and can export your app to MacOS and Windows.
Checkout muon which is best described by their readme:
Muon is a lightweight alternative to Electron written in Golang in about ~300 LoC, using Ultralight instead of Chromium. Ultralight is a cross-platform WebKit rewrite using the GPU to target embedded desktop applications that resulted in a fast, lightweight, and low-memory HTML UI solution that blends the power of Chromium with the small footprint of Native UI.
I have not used it myself but it looks very promising!

How do I run a system command in a cydget using objective c or javascript?

I am trying to run a Ruby script from a cydget (cydget is a framework made by Saurik for writing lockscreens on the iPhone, using cycript, which is a mix of javascript & objc - see http://www.cycript.org/ ) The script will first check to see if a WEBrick server is running, if so it will quietly exit, if not it will start the server.
Apparently the iPhone doesn't support NSTask, and I don't know if the cycript implementation of obj-c does or not. (To be honest, I have no clue how obj-c in cycript works at all!) I'm not worried about security, because I'm running 1 specific command: "ruby server.rb", and everything else will be handled through the web server itself.
Is there any way other than NSTask in objective-c, or any way in javascript or HTML that I can run an arbitrary command on the local machine?
Thank you!
Brent
You can't fork another process on an iPhone at all (assuming we're talking about a legitimate app developed against Apple's official SDK). No NSTask, no fork()/exec(), no system(), nothing.
So it sounds like the best solution is to just wait - Saurik will be coming out with a way of directly using Ruby in a cydget, but it likely won't be out for a few months... :( I hope it will be worth the wait though!

Categories

Resources