To be used on staging sites of akarion. This will force users to authenticate in order to access a stage URL and display a hint that they are on the stage site.
npm install stage-auth-middleware --save
Now you can use it in your server with
const express = require('express');
const stageAuthMiddleware = require('stage-auth-middleware');
const app = express();
app.use(stageAuthMiddleware({
pass: 'super-secure-password',
enabled: process.env.NODE_ENV !== 'production',
}));
Now add the script to your index.html file(s)
<script src="/stage-auth-middleware.js" async defer></script>