This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { BaseMemoryStore, Store } from 'express-session'; | |
export class MemoryStore extends Store implements BaseMemoryStore { | |
/** | |
* A key/value mapping of session IDs to serialized (stringified) sessions. | |
*/ | |
private readonly sessions: Map<string, string>; | |
public constructor() { | |
super(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @template {(...args: any[]) => Promise<any>} T | |
* @param {T} fn | |
* @returns {(...args: Parameters<T>) => Promise<ReturnType<T>|void>} | |
*/ | |
export const wrap = (fn) => (...args) => fn(...args).catch(args[2]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*! | |
* Destroy all open connections so a server can close. | |
* Inspired by https://github.com/marten-de-vries/killable | |
*/ | |
import http from 'http'; | |
import { Socket } from 'net'; | |
// Set of open sockets | |
const sockets: Set<Socket> = new Set(); |
NewerOlder