Updated README for new members-ssr API

no-issue
This commit is contained in:
Fabien O'Carroll 2019-09-16 14:00:00 +08:00
parent 667061676b
commit 49380c3dc4

View File

@ -24,7 +24,7 @@ const {
cookieName: 'members-ssr', // Name of cookie (default)
cookiePath: '/', // Path of cookie (default)
cookieKeys: 'some-coole-secret', // Key to sign cookie with
membersApi: membersApiInstance // Used to fetch data and verify tokens
getMembersApi: () => membersApiInstance // Used to fetch data and verify tokens
});
const handleError = res => err => {
@ -34,9 +34,9 @@ const handleError = res => err => {
require('http').createServer((req, res) => {
if (req.method.toLowerCase() === 'post') {
exchangeTokenForSession(req, res).then(() => {
exchangeTokenForSession(req, res).then((member) => {
res.writeHead(200);
res.end();
res.end(JSON.stringify(member));
}).catch(handleError(res));
} else if (req.method.toLowerCase() === 'delete') {
deleteSession(req, res).then(() => {