Serve a react app made with create-react-app

I am trying to serve a react app made with create-react-app on my website. The react app is in another repository, but I have managed to clone it with some flags in the Caddyfile so that part is done.

My caddyfile looks like this:

https://andrinelossius.com

git github.com/andrinelo/andrinelossius {
clone_args --recurse-submodules
pull_args --recurse-submodules
}

root andrinelossius

I get a 404 when I go to andrinelossius.com/blank. When I run the react app locally, I have to run it with npm start, could something with that be the problem?

Maybe this works?

git github.com/andrinelo/andrinelossius {
clone_args --recurse-submodules
pull_args --recurse-submodules
then_long npm start
}

Edit: According to your github repo you need to run npm install beforehand so you might want to start caddy then cd to the clone directory and run npm install and then restart caddy again

Edit nb.2:
I’ve tried blankspill out myself and you just have to run npm install (or yarn install) and then the public folder is populated with the desired react-app and this worked for me:

  root /blankspill/public
  git {
    repo https://github.com/andrinelo/blankspill.git
    path ../
    clone_args --depth=1
    hook /webhook secret
    then_long yarn install
  }
2 Likes

First day back after vacation so trying to get back to stuff. Still cant get this to work. I get an 404 when I visit andrinelossius.com/Blank. But the repository is cloned so dont know what is wrong. Why dont you have to include then_long npm start?

My Caddyfile now looks like this:

https://andrinelossius.com

git github.com/andrinelo/andrinelossius {
        clone_args --recurse-submodules
        pull_args --recurse-submodules
        hook /_webhook some-keys
        path ../
        then_long npm install
}

root andrinelossius

edit: Added path …/ in the Caddyfile