I'm deploying React app on PA. The app has only one component to begin with so no routing on client-side. I'm using Flask on backend:
blog_blueprint = Blueprint('blog', __name__, static_folder='~/blog/client/build/static')
api = Api(blog_blueprint)
@blog_blueprint.route('/')
def index():
return blog_blueprint.send_static_file('~/blog/client/build/index.html')
mapping of static files looks like this:
URL Directory
/ /home/markalexa/blog/client/build/static/js/main.e7045ac6.chunk.js
the code above is based on what I've gathered on the web and in official docs https://create-react-app.dev/docs/deployment
When I type in my domain and hit enter the page renders React code as a plain text:
(this.webpackJsonpclient=this.webpackJsonpclient||[]).push([[0],{10:function(t,e,n){},11:function(t,e,n){"use
strict";n.r(e);var c=n(0),i=n(1),o=n.n(i),s=n(3),a=n.n(s),p=(n(9),n.p+"static/media/logo.6ce24c58.svg"),r=n.p+"static
/media/python.f22d1fce.png",l=n.p+"static/media/react.80045de7.png";n(10);var d=function(){return Object(c.jsx)
("div",{className:"App",children:Object(c.jsxs)("header",{className:"App-header",children:[Object(c.jsx)("img",
{src:p,className:"App-logo",alt:"logo"}),Object(c.jsx)("p",{style:{marginTop:"10px",paddingBottom:"30px"},children:"This soon is going to be"}),Object(c.jsx)("img",{src:r,style:{height:"60px",width:"auto"},alt:"Python Logo"}),"\xa0\xa0",Object(c.jsx)
Any assistance is very much appreciated.