I am building an app that I want that before the user can get anything from the server he will need to answer a few authentication questions.
When I am using node in command line I can ask the user to answer my questions with 'prompt' package.
Something like thet:
const express = require('express');
const prompt = require('prompt');
const app = express();
app.use((req, res, next) => {
prompt.start();
prompt.get(['user', 'pass'], (err, result) => {
console.log(' username: ' + result.user);
console.log(' password: ' + result.pass);
}
}
const server = http.createServer(app);
server.listen(3000);
Now the question is how do I 'promt' the browser 'Window.prompt' instead of the command line 'prompt'?
I know it is possible because nginx 'basic_auth' asks for authentication and opens the prompt dialogue.
So first how do I open just an auth prompt. secondly can I do it also for other things beside authentication?