GEWIS / parelpracht-client

ParelPracht is the CRM system of Study Association GEWIS, used to automate repetitive tasks and provide insights in the collaborations with companies.
GNU Affero General Public License v3.0
3 stars 3 forks source link

[Feature] Fallback page when server is not running #85

Open Yoronex opened 1 day ago

Yoronex commented 1 day ago

When the PP server is not running, the client will load forever. It would be nice to have a fallback page that mentions that no connection to the server could be made. We can do this by checking the call to /getPublicGeneralInfo: if this does not return a 200, PP is not running and we should draw a nice "CBC HET IS STUK!!!11!!1!!".

Tqduy2k3 commented 1 day ago

you can create a file html to display what you want as

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>404 - Page Not Found</title>
    <style>
        body {
            text-align: center;
            margin-top: 20%;
            font-family: Arial, sans-serif;
        }
        h1 {
            font-size: 3rem;
            color: red;
        }
        p {
            font-size: 1.5rem;
        }
    </style>
</head>
<body>
    <h1>404 - CBC HET IS STUK!!!11!!1!!</h1>
    <p>Er kan geen verbinding met de server gemaakt worden.</p>
</body>
</html>

then you link function display error to it example: res.status(404).sendFile(path.join(__dirname, '..', '..', 'public', '404.html'));

Tqduy2k3 commented 1 day ago

you can create a file html to display what you want as

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>404 - Page Not Found</title>
    <style>
        body {
            text-align: center;
            margin-top: 20%;
            font-family: Arial, sans-serif;
        }
        h1 {
            font-size: 3rem;
            color: red;
        }
        p {
            font-size: 1.5rem;
        }
    </style>
</head>
<body>
    <h1>404 - CBC HET IS STUK!!!11!!1!!</h1>
    <p>Er kan geen verbinding met de server gemaakt worden.</p>
</body>
</html>

then you link function display error to it example: res.status(404).sendFile(path.join(__dirname, '..', '..', 'public', '404.html'));

create try catch for /getPublicGeneralInfo to get error