aex session for basic http request
npm install @aex/session

This package is created for Aex, but it is useful for Node.js http callback.
``ts`
npm install @aex/sessionor
yarn add @aex/session
`ts`
import { MemoryStore, Cookie } from "@aex/session";
import * as http from "http";
const store = new MemoryStore();
const cookie = new Cookie(store);
const scope: any = {};
const server = http
.createServer(function (req: any, res: any) {
cookie.parse(req, res, scope).then(() => {
scope.session.user = "alice";
res.write("Hello World!");
res.end();
});
})
.listen(port);
RedisStore uses node-redis and takes exactly what createClient takes which described here;
`ts`
import { RedisStore, Cookie } from "@aex/session";
import * as http from "http";
const store = new RedisStore();
const cookie = new Cookie(store);
const scope: any = {};
const server = http
.createServer(function (req: any, res: any) {
cookie.parse(req, res, scope).then(() => {
scope.session.user = "alice";
res.write("Hello World!");
res.end();
});
})
.listen(port);
> scope is optional. If scope is not provided, session will be attached to req`, make sure session is request specific even scope can be global.