we have a Heroku hosted nodejs server that servers a rest API. We want to add an endpoint to which we can upload an APK and have the server spin up a test for us on Firebase.
I can't seem to find any nodejs server side libraries from Google to help me achieve this.
In your nodes server, you could call Cloud Testing API directly to start a test. Test execution results can be retrieved with Cloud Tool Results API. Both of these two APIs are public API and there is Nodejs client support.
Related
I am working on the node.js and express to build API, however I want to make the API design on the runtime by designing the REST api endpoint with body param and return param, but how could I automatically deploy this api to the server without manually restarting the server and automatically monitor this api traffic, when i don't want to deploy the api I want stop it manually on the UI.
I wonder is there any ways or frameworks to work with in node.js
Obviously Firebase Cloud Functions cannot access http services on localhost, once deployed (as per this answer). However, is there a way to test local http services when running the cloud functions emulator locally?
I have a node.js app and various firebase emulators running in docker containers (with docker-compose), all using different ports. I need my cloud function to send a POST request to the node app, and I'd like to test this all on my local machine.
The cloud function (hosted at http://0.0.0.0:3318) gets an ECONNREFUSED error when I attempt to post a request to my node app (at http://localhost:2018) using axios.
Using the magic of docker-compose networking, I found I could connect to my node.js service (named api in my docker-compose.yml) from my emulated function simply using the url http://api:2018
I have a react native app that I'm building using expo. For the backend, I am using node.js and Express.
My app hierarchy is such that I have a frontend folder and a backend (server) folder. For example,
Root
|
|Frontend
|Various screens & associated files
|Server
|Routes & other files
For my project, is it possible to just host the backend and not the rest of the app? Such that when I fetch data in the frontend using HTTP requests, instead of routing through localhost (http: //RandomIP:PORT/route) I would use the heroku address as the routing address. I would also host the SQL database along with it.
I tried to follow along with the Heroku documentation, but it seemed like that was for hosting the entirety of the app / web apps instead of mobile, and I ran into constant errors.
I would like to point out that, unlike web pages, mobile apps cannot be hosted on the server and fetched on-demand. In other words, do not try to upload your react-native code to Heroku instead just upload your backend only and then make HTTP requests through the URL provided by Heroku after you have deployed your code.
Therefore go into your backend codebase, initialize a git repository and just deploy that Heroku. Also, you will need to host your SQL database on another service such as Google's Cloud SQL or Amazons AWS Database Services.
I am developing a web application in React with a Node.js back-end. I would like to host the images and static files built for the React application on Cloudfront. However, the React application relies on the Node.js server to obtain some changing data to populate the views.
I need to have a thorough understanding of the flow of the application in order to come up with a reasonable design. Here is what I think happens:
User enters URL in the browser
Client is directed to the closest Cloudfront edge location
Cloudfront serves the HTML and images to the browser
The React application bootstraps in the browser
An API call is made to the Node.js server, which returns the required data
The browser renders the React application.
Am I understanding this correctly? Is there a better way to architect my web application?
I am not able to find the information I require online and would appreciate any help!
Your architecture is correct.
Just to be clear, CloudFront is not hosting your files. CloudFront is a cache and will fetch your files from an Origin, typically an Amazon S3 bucket.
Using React && AWS Amplify, you can create a serverless architecture for this type of setup with minimal work. You can get started by following the instructions at https://aws-amplify.github.io/docs/
In a nutshel :
Install with:
npm install -g #aws-amplify/cli
$ amplify configure
Then in your project :
amplify init
amplify add api #this will create your API as AWS Lambda functions exposed through Amazon API Gateway)
amplify add hosting #this will create the Amazon S3 bucket for hosting and the cloudfront distribution)
amplify push #to create all this on your AWS account for you
If you search for 'aws amplify react' you will easily find a dozen blog posting showing you how to get started. There are so many I can not recommend one in particular.
I wanted to make mobile app from existing webapp. My webapp is nodejs-exressjs REST API server, with HTML/JS client.
I wanted to leverage API from my REST server, and swap out client with phonegap/cordova based mobile app.
Till now, the only feasible solution seems to be use CORS, and have phonegap/cordova server and nodejs servers running separately.
Is there a way I can use same server to deploy both my REST Server, and Phonegap/Cordova Client ?
No sorry, Cordova apps rely on having the front client in local, and perform calls to server in REST, so your first thought is correct. You can share the REST server for both applications, but the code of the cordova app client is going to be in the devices locally, without need of a server.