How to use node.js code inside php file/script - javascript

I am very new in node.js, I am creating a bitcoin application in php and I need to use Bitgo API for creating wallet address and bitcoin transfer.
Bitgo have there API in node.js only. Please help me to call node.js API inside my php code.
Here is the API listed.
https://www.bitgo.com/api/?javascript#create-address
On user signup I need to execute the Bitgo API for creating addresses inside wallet. Bitgo returns the wallet address in response and I have to store in my database.
Thanks in advance!

The BitGo Express REST API is a lightweight service for developers that want to take advantage of BitGo but are developing in a language without a native BitGo SDK.
BitGo Express runs as a service in your own datacenter, and handles the client-side operations involving your own keys, such as partially signing transactions before submitting them to BitGo. This ensures your keys never leave your network, and are never seen by BitGo. BitGo Express can also proxy the standard BitGo REST APIs, providing a unified interface to BitGo through a single REST API.
To use BitGo Express:
Install BitGoJS
Run the following command in the bin directory:
./bitgo-express --debug --port 3080 --env test --bind localhost
Make all BitGo REST API calls to the machine on which bitgo-express is running.

Related

ReactJS client and ExpressJS backend application production problems

I am new in reactjs and nodejs.I made an application with react frontend and express backend. There are axios post and get requests for get data from mssql database via express.
When the project in production level, I write the IPv4 address and port for access dashboard from another device in local network. After build,when I use for example localhost:5000 for requests, I can see all datas which are come from database in the device which react project running but with this I cant see datas from android phone in local network.
What should I do? Isn't there any other way than writing a static IP address? This project can be run different machines.
I am sorry for my spelling mistakes.

How to start big nodejs project virtual classroom?

Developers i'm a nodejs developer with a experience of 1.5 years working in the company my question is i'm doing a project which is called a virtual classroom like a webinar platform where chat support, drawing and etc functionalities are available, so from last 2 month had been done of working in project i had gone through the each component directory and file with it's documents also they have used of docker, redis, proxy server, nginx, session, mongodb these kind of services and it's working fine on server end side but can't able to stablish on my local machine and it's a linux based project where have numbers of powershell files with PM2 library to make it run... so i followed a docs with some code also i success to make the service on and registered a local domain also in hosts file or nginx custom configuration it is working fine... but when i hit my ulr on browser with the local domain it not going to any of the route....
Example - like if we make a node simple project with hello world and it will working on 4500 port so we write localhost:4500 and it will print our responce on browser
but if the run my project through a PM2 or a simple node app.js bcoz this app.js have connected with all nodes services and virtual classroom and you the linux platform we don't need to make serivice on it's by default in runing state monogoDB, redis, docker, nginx but the real question is while firing the command node app.js it shows some json and told port:2178 but when in hit this on browser localhost:2178 not responce to GET request why??? but there is route called localhost:2178/landing/session/v1/classid(which is encrypted code) this url not working what to do ??

How to publish to a GCP PubSub topic from inside a Cloudflare worker

Is it possible to publish to a GCP PubSub topic via a basic HTTP request? I have a Cloudflare worker from which I'd like to publish directly to a topic. I originally tried bundling the NodeJS module, but webpack (via wrangler) was unable to build due to dependencies (specifically tls) that are unavailable in the server worker environment.
It seems API keys aren't supported on the PubSub API and I can't for the life of me find a way to use a service account without using an SDK.
Sort of. There is the publish method that uses REST, but it requires OAuth2.0 authorization. I'm not sure if you'll run into the same issues as using the NodeJS client library, but if so, you'll have to use an intermediate service (i.e. Cloud Functions/Compute Engine/App Engine) that exposes an HTTP endpoint that can do the authentication for you.
For more information on using OAuth2.0, see this link here: https://cloud.google.com/pubsub/docs/authentication#user-accounts

How to create a nodejs websocket client

I'm working on a project where I need to have multiple node clients connect to a node server via websockets. The clients will send files to the server and the server will immediately distribute that file to all connected clients.
The problem I'm running into is connecting as a client in node. The built in ws module seems to only support server use. I've also tried the npm websocket client which allows me to use node as a client but I seem to only be able to send binary data without any other information like the filename, etc. using the sendBytes method.
Thanks for any suggestions.
Checkout the delivery package of npm.
It provides bi-directional file tranfer for node.js over socket.io.
https://www.npmjs.com/package/delivery

Consume Rest API on same ip but different port

Let's suppose a backend application, which exposes some Rest API, running on a Jetty webserver at address 192.168.1.10:8889.
I would like to have a frontend application (html/javascript only, on a apache2 webserver) running at the same IP but on a different port (e.g. 8000), which should consume the API exposed by the backend application.
How can i get this architecture working without get into "No 'Access-Control-Allow-Origin'" error?
I think that you should install a nginx proxy.
configure it as a reverse proxy you can see documentation here :
https://www.nginx.com/resources/admin-guide/reverse-proxy/
You can search on google for more specific documentation on what you want to do.

Categories

Resources