Friday 5 May 2017

Error finding html file with fly

I am deploying my first website where I used nodejs in the backend. I am facing an issue for which I have not been able to find a solution for. The website is running perfectly localy and I deployed it a first time with heroku (free version), there was no problem at all.

I just paid for a vps so I would be able to deploy my application with flightplan. Everything works and the website is correctly deployed to the VPS, but when I try to access it with "ip-address:port" I get the following error:

Error: ENOENT: no such file or directory, open './views/base.html'. 

Would anyone have an idea on how this happened?

The line that calls the file is:

var file = fs.readFileSync("./views/base.html", "UTF8");
res.status(200).send(file);

Thanks for your help !

Edit: In the server.js file I use the following line to 'hide' the files in the frontend, could it have something to do with that?

app.use('/webapp', express.static(path.join(__dirname, '/views')));



via Arnaud Rochez

No comments:

Post a Comment