Web アプリ フレームワークとして Express を実行するノード アプリがあり、認証に Stormpath を使用しています。
ストーム パスは、いくつかのミドルウェアでルートを保護する機能を提供します。次に例を示します。
router.get('/user_data_api', stormpath.apiAuthenticationRequired, function(req, res) {
res.send('hello you are authenticated!");
});
});
私がやりたいことは、expression の静的定義にミドルウェアとして authenticationRequired を追加することです。
app.use(express.static(__dirname + '/public'));
これは、静的アセットにルートを追加することで実現できるため、ファイル ./public/index.html がある場合は、次のようにルートを設定できます。
app.use('/secured-assets',
stormpath.auth_fn, express.static(__dirname + '/public'));
しかし、その後、ファイルは
www.mydomain.com/secured-assets/index.html
そして、私はそれが欲しい
www.mydomain.com/index.html
ヘルプ?