CSS throwing 503 error with node.js on a2hosting
If you are able to see html and not CSS, try tweaking second parameter where you specify the directory location.
app.use('/testapp/static', express.static('public'));
The path that you provide to the express.static function is relative to the directory from where you launch your node process (link).
I had provided a sample code which you could refer where I had put one folder inside the directory and one outside. - https://codesandbox.io/s/sweet-grass-0dxvh?file=/testapp/server.js
Please, make sure that your
testapp
is a correct Application URL (not Application root)Your starting file is called
server.js
, however your package.json refers toapp.js
. Don't you have some additional files which may work instead of the one you think? Please, check the Application startup file is correct.If the first options didn't help, check the
.htaccess
file configurations in your/home/<username>/public_html
directory according to the instructions https://www.a2hosting.com/kb/installable-applications/manual-installations/installing-node-js-on-managed-hosting-accounts#Integrating-a-Node.js-application-with-the-web-server
Please let me know if some of the options were helpful or you need some additional information or research.