Flask for server and Node.js for API? [closed] - node.js

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I am currently developing a web app using Flask, while one of my peers is developing an API using Node.js. The end goal is to use the API for all database queries and I am currently posting to the API in the backend of the flask application, but I am wondering - do I still need to use Flask as a backend if we have a separate API?

Yes, having a separate application for your web app and your data API is a good idea. This is a good practice for when you want to scale up an application.
Think of it this way... your API will probably service more apps than just your web application. If you decide to build a mobile app, your web app and your mobile app will consume data from the same API, but serve different users. Your web and mobile apps are handling two different pools of users, but your API is handling all of them. Therefore, your API will probably scale up faster than your mobile or web application services.
If your data API and your web app are the same application, you would have to scale them up as one service even though your web app might not be the core contributor to API traffic.

It depends on what you're using for your front end, if you're using some kind of javascript framework (Angular, React) you can just make the API calls from the client side.
But since you haven't mentioned those it sounds like you're just using Flask's template engine (Jinja) which is a server side template system. So you'll still be using Flask on the backend to build the templates.

Related

How to do Production deployment of React + Nodejs? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 months ago.
Improve this question
I am trying to understand how to deploy the web application with docker and do a production level deployment.
I made a web application with react as front end and Nodejs as backend. I used Mangodb for database.
I used proxy to connect both front and back-end , so that they started communicating with each other.
The web application working good as I built and API and routed through front-end.
My Goal:
To deploy using Devops and CI/CD pipelines.
With my research , the best possible options are :
using docker
using circle ci with docker
But I still havent found a way on how to deploy the entire web application .
should I deploy the front-end and back-end using docker and setup github actions? Is this the right way to deploy the applications and if so how does the front-end and back-end can talk with each other?
options: deploy both front-end and back-end with docker and figure out a way on how they communicate with each other.
My last experience was deploying backend on heroku and use that link as proxy in the front-end where I deploy it via netlify.
option 2: use circle-ci and docker combined to deploy both front-end and back-end.
Can anyone suggest the best way to approach this situation ? and best resource to lookup where I can deploy the entire web application using devops tools .
Thanks
I thought of sharing my experience. This could be slightly helpful to your issue.
Are you using any aws services ?
For our projects, we're using aws. To deploy frontend applications, we're hosting them in S3 buckets and use cloudfront as edge locations to serve the requests. For backend, ECS cluster based on EC2 launch type is used. For backend deployment, docker is necessary to containerize each application image and create tasks in ecs cluster.
To use CI/CD, I'm using github, github web hook, codebuild and codepipeline. If any commit is made through a pull request, such changes are identified via web hook and then codebuild and codepipeline runs to build and deploy the changes to relevant environments.

Web API and web application in one project vs separate projects

I am completely new to the concept of servers, web APIs and web applications. I have a project where I need to design a Web API that allows clients to modify a database (hidden from the clients through the API).
And there is also a web application which has some functionalities. The web application also has to interact with the database.
So my question is, should I develop the Web API (Server) and the web application in the same project or two different projects?
I chose to implement the system using Mean stack for learning purposes. Mean stands for MongoDB, ExpressJS, Angular and NodeJS. As the Mean stack contains technologies to develop both the API and the Web app, am I supposed to develop all the code within one project and deploy it in my server or separate the Web API and the web application into two projects?
If it depends on the scenario, then to which kind of scenarios should I choose each and what are their pros and cons?
If shortly, Web API, it's backend, it's service, which you use in web application, and, web application, it's frontend, it's web site, which you see in your browser.
You can create one repo at github but server-side and client-side projects are separated.
You can choose the structure of your server-side and client-side projects depending on the purpose of your project. If you are going to create web application and then to develop mobile application (with ionic, for example) you should create web API separately. If you are going to create only the web application and to deploy your web application and web API to the same service (like heroku) you can make the same structure as in the heroku example (https://devcenter.heroku.com/articles/mean-apps-restful-api , also check the repo of this example https://github.com/chrisckchang/mean-contactlist-angular2 ).

MEAN stack application design

Looking for some insight/advice.
I'm creating an app where I want to expose an API that will be used by 3rd parties as well as my own web and mobile apps. Looking at the MEAN stack to do this. My thinking is that I should create 2 apps:
Express-based API app that talks to the MongoDB. No UI, just RESTful endpoints.
Angular-based web app with the UI. Does this app require Express? This app will hit the API endpoints to get/put data to the backend. Can Angular run on its own or does it need Express/Node. My thoughts were for Angular to handle the UI page routing and Express to handle the API routes.
Also, in the mix, is an iOS mobile app and Android app. These will also hit the API for data.
My background is heavy Java/Spring/Hibernate/Spring Boot and .Net. So, explaining MEAN stack as it relates to Java technology/frameworks would help!

Configure WAF Application Gateway in front of App Services [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I have a VNET with two App Services and one Windows VM in Azure. They are in the same VNET using VPN point-to-site.
I want to protect this environment with a WAF and have read that I can use Application Gateway WAF instead of the very expensive setup with App Service Environment and Barracuda.
Could anyone please explain how I can achieve this? The closest I have found is https://learn.microsoft.com/en-us/azure/application-gateway/application-gateway-web-application-firewall-portal .
In case someone has the same question, starting from July 2017, the Azure Application Gateway with Web Application Firewall supports App Services deployed in the multi-tenant environment. As described here.
More information on how to configure it here.
Support for Azure Web Apps as backend pool member is not currently supported on Application Gateway. However for App Service Environment (ASE) there is a workaround possible. Refer to this blog post - http://sabbour.me/how-to-run-an-app-service-behind-a-waf-enabled-application-gateway/
You can use a NSG to lockdown the Internet calls and only allow calls from the AG to the ASE.

Which Amazon web service for Node Js server? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 6 years ago.
Improve this question
I am quite confused with Amazon Web Services, all that I want to do is to create a Node Js server on amazon and running it. Which service I should use ?
Here the list of services
Shoud I use CloudFront ? EC2 ? Elastic Beanstalk or or other ?
Any help would be really appreciated
I would not be so categoric as "use ec2" or "use something else" ...
well clearly on AWS if you want to deploy a node application, you have 2 main choices:
ec2 : https://codeforgeek.com/2015/05/setup-node-development-environment-amazon-ec2/
The Infrastructure as a Service (IaaS) offering from Amazon, you're free to do what you want/need and you manage your own servers.
elasticbeanstalk : http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create_deploy_nodejs.html
The Platform as a Service (PaaS) offering from Amazon, aws will provide you machines, sdk versions etc you will use to build your app and you manage only your app not the servers
each comes with their pros and cons. You can read this op about some of the differences.
Basically I will sum up like this:
If you're building a 'small' web app or want to concentrate purely on your app and do not use fancy 3rd party tool/libs go with ElasticBeanstalk, you develop your app you deploy your app and it works. aws will manage the servers, you can set up rules to scale automatically, you can connect to other aws services (mainly RDS for database, SNS for mail notification ...)
If you have access to IT resources who know how to setup and manage a server (including security ...) and need to develop an app with many additional services, lib that might not be supported by aws eb or other aws services (such as setting up a mongo db, there's no out of the box offering from rds or other so you will need to install on ec2 server or user another 3rd party services which provides this)
The topic is not to discuss all aws offering but just to complete on your question, cloud front is the CDN system of AWS so if you use a lot of static assets (JS, css, images ...) you should look into it, wether you use S3, eb or ec2 to deploy your app you will be able to use this service. It speeds up the delivery of static assets to your users by caching them on edge location closed to those users.
For Node js EC2 service should be used.
You have to install a software named putty configure it and run your node js script like you run on your localhost.
Here are some links to tutorials:
https://www.youtube.com/watch?v=WxhFq64FQzA
https://aws.amazon.com/developers/getting-started/nodejs/
To deploy files you can simply use FTP instructions given below:
Connect to Amazon EC2 file directory using Filezilla and SFTP

Resources