December 2016
Intermediate to advanced
841 pages
17h
English
In lib/server/index.ts, we will first add sessions. A session is a place to store data, which is persistent for a client on the server. On the client side, a cookie will be saved, which contains an identifier of the session. If a request contains a valid cookie with such an identifier, you will get the same session object. Otherwise, a new session will be created:
import { Server, ServerRequest, ServerResponse, ServerError, StatusCode, SessionStore } from "phaethon";
import { ObjectID } from "mongodb";
import { User, login, logout } from "./user";
import * as note from "./note";
With import { ... }, we can import a set of entities from another file. With import * as ..., we import the whole file as an object. The following ...
Read now
Unlock full access