@abtnode/passport 中文文档教程
@abtnode/passport
ABT Node Daemon 提供给 Blocklet 的页面通行证中间件,方便在打开 Blocklet 内的敏感页面时要求管理员身份,比如 admin_url
和 config_url
/* eslint-disable import/no-extraneous-dependencies */
const express = require('express');
const passport = require('./lib/index');
const app = express();
app.use(
passport({
nodeHost: `http://127.0.0.1:${process.env.ABT_NODE_PORT}`,
blockletSk: process.env.BLOCKLET_APP_SK,
blockletRoutes: /^\/private/,
})
);
app.use('/public', (req, res) => {
res.send('this is public');
});
app.use('/private', (req, res) => {
res.send('this is private');
});
app.listen(4001, () => {
console.log('ABT Node GQL Server at http://localhost:4001/private?__st__=sometoken');
});