How to make a development flask server easier to start? - python-3.x

I am doing some backend code in a flask application and would like to make it easier for the front end developer start it locally so he could test the app and change front.. I would like that it was possible for him to just execute a file that downloads all the requirements and starts the server.. Can I use virtualenv of my machine on his one so he don't have to download everything?

I'm following this tutorial, he is complete from hello world to deploy your application.

Related

How to 'build' a node js application?

I have a node.js application that run as a application server.
It is deployed on an Ubuntu 20.04 machine running on AWS, uses nginx as a reverse proxy and PM2 as a service starter.
Everything seems perfectly configured.
What looks strange to me, is that I have a React application, in a similar environment, but, before to move it on the server, I run build it, so creating a sort of packed and not easily human readable application.
My question is: Is there the need to do the same with a node.js application?
And, in case of positive answer, How to 'build' a node.js application?
There is no need to build a normal nodejs application.
What you mean is the use of a bundler e.g. webpack and a javascript compiler e.g. babel. To create a react application, you usually use a tool like create-react-app that sets up all this stuff for you. For react you need the compilation beacause you use the jsx syntax that browsers do not understand. In addition to that a bundler has some more advantages.
Check out this video if you want to know more about it:
https://www.youtube.com/watch?v=5IG4UmULyoA
No you don't have to build anything for node.js you just have to run the server. for client side apps you need to build and serve the Dist through web servers like apache or nginx.

Docker vs node.js

I'm fairly new to React-native. Im sorry about quite a convoluted question but I have dilemma. I am building an API that communicates with a server app that Im working on, I have been using Docker successfully to run containers BUT I'm constantly being told that I don't need to run Docker at all. I understand the principles of Docker and Node.JS but in all honesty I cant imagine how I would run server side without Docker. Ive tried Node.js and seemed to require a PHP server, which I was also told I did not need. Is this true? which is better Docker or Node.JS? and If Node JS is better how to run it without a php server as it is my understanding that php serves the pages and React consumes the pages.
'You can just install Node, frequently through your OS's package manager. It doesn't require PHP or other language interpreters. I find working directly with Node much easier than using Node in Docker: it is actually a local development environment that my IDE is comfortable with, and not a path to run a Node interpreter "somewhere else" that's isolated from my desktop tooling. '
1)After a few weeks of research I found that I didn't need docker at all. Within Node is the ability to run a server using either fastify or express. I just needed to check on the relevant documentation for usage
2) I linked fastify to ngrok and exposed my local IP address to a public facing direction
3) I linked the ngrock url to my freedns and voila! it worked!
4) I had a small problem with the port which was resolved by using
the command ngrok http 127.0.0.1:5000

How do I setup and deploy a local execution app for Google smart home action?

I am implementing the local execution functionality for my google smart home action. I am following the steps in this link:
https://developers.google.com/actions/smarthome/develop/local
I have already configured the scanning data in the console, and now I am trying to deploy my local execution app. I know how to program in javascript, I have created a couple of firebase functions, but I am not an expert in node.js. I don't understand how to setup and run this javascript app.
I tried to run it on the browser, but it says it cannot find "require", and I read that node.js is not supposed to run on client side. In the link above, it says to create an index.html, that declares the "local_execution.js". Is this javascript module going to run on client side? Can someone point me in the right direction? Maybe explain how to setup the app directory.
Thank you in advance,
Henrique
The best place to get started would be with the local home sample app on GitHub. This sample includes both a local execution app and a compatible virtual device, with instructions to get it compiled and deployed.
For testing, you need to host the web app (HTML/JavaScript) in a location that's accessible to your Home device. This could be a local dev server or something like Firebase Hosting (the sample has instructions for both). The hosted URL goes in the console under Test > On device testing.
I tried to run it on the browser, but it says it cannot find "require", and I read that node.js is not supposed to run on client side.
The Home devices run a browser-based (Chrome) environment, so your JavaScript must be compatible with the browser. If you use Node programming paradigms (e.g. importing modules using require) in your code, you need to use a bundler tool such as Webpack or Parcel to package the code for the browser. The sample uses Webpack to accomplish this.
Side Note: You can't run even a properly packaged local home app in the browser on your development machine because the local home SDK only exists on Home devices.

What is the best way to execute nodejs app on a server?

Is there a panel for run node app?
Just have to run it on the server?
Set everything up manually?
Manual installation xngin ,apache ,mongodb , ...
Manual Server Configuration.
Is there a similar panel Vesta?
There are services like Heroku or Digital Ocean where you can get a node server up without having to do a lot of setup (i.e. not touching apache or nginx etc.). I think that's what you're looking for.
https://devcenter.heroku.com/articles/getting-started-with-nodejs#introduction
Honestly after creating a social network in React, PHP and mysql I would recommend uploading the build files to a conventional hosting provider. Not only is it cheaper in the long run but it is probably easier to use. You can do this by typing "npm run build" then uploading the files in the build folder to your hosts main directory either manually or by ftp in atom etc... but it's basically depends on your work flow and whether or not you have a dev ops guy on your team.

how to deploy nodejs rest api with express framework on production server windows

I have created a node.js rest api created using express framework for routing. I have used tutorial
Now I want to deploy that rest api on actual production server. How to achieve that thing.
I have gone through below links.
Deploy node js application with express framework on production mode --- Only for linux. I need for windows.
Deploying NodeJs Express Rest API to Windows 10 IoT -- a little bit similar problem but no solution
https://stackoverflow.com/a/38652869/2810015 -- this said to run npm start on production server after copying all of the files on server. But this is not working fine either.
Any help will be highly useful.
You use pm2?
Usually I use it to start the application. It works for both windows and linux. He leaves the service initated, and in case something happens that knocks the service up again.
You install it on the server, and instead of using it
node server.js
You use the command below
pm2 server.js start
Link: http://pm2.keymetrics.io/docs/advanced/pm2-module-system/

Resources