Here is the link to my github repo: https://github.com/syne612/projectIcarusWebsite
Im not sure what the issue is.
the server/app file in the root directory is not used to start the app. check the package.json file for entry point
Here is the link to my github repo: https://github.com/syne612/projectIcarusWebsite
Im not sure what the issue is.
the server/app file in the root directory is not used to start the app. check the package.json file for entry point
Hi, in local its working?
I didnt see you generated the static file for heroku in the index, its normal? I m on my mobile I cannot find for you now but I ll send u after if you want.
yea that would be great.
Im new to deployment. this is actually my first attempt to deploy an app.
Ok Add this:
const path = require(âpathâ);
app.use(express.static(path.join(__dirname, âclient/buildâ)));
app.get(â*â, (req, res) => {
res.sendFile(path.join(__dirname+â/client/build/index.htmlâ));
});
I recommend you highly also to compress your bundle, the performance will be much higher:
const compression = require(âcompressionâ)
app.use(compression())
Next time you create an app you could use create-react-app, this way to connect server and front end you just need to create a proxy like this: âproxyâ: âhttp://localhost:5000/â on the package.json of client (port must be the same as on server).
Also, If you use dotenv, dont forget to install the package + to require it: require(âdotenvâ).config();
But if you deploy on heroku, you dont need it as you can directly include the variable on heroku
Oups i almost forget something important:
add âheroku-postbuildâ in your package.json
on my package I have this: âheroku-postbuildâ: âcd client && yarn && yarn run buildâ
Concerning your project, I guess you can try this: âheroku-postbuildâ: âbuildâ
hey ok so let me first say thanks for the help so far. second where should i add the code from your first post of these 3? the one that starts with const path? should these go in my index.js file? part of the issue with this is that i was using a template/ UI kit for this. thats why the code is so âjankyâ. Ive even debated rebuilding this on my local machine using my own variation packages and server set ups (âcreate-react-appâ) and then just copying the components files. part of the issue is the way the css is built in this. its done in react which is making changing code around a bit of a pain.