8 lines
211 B
TypeScript
8 lines
211 B
TypeScript
import jwt from "jsonwebtoken"
|
|
import getKey from "./getKey"
|
|
|
|
|
|
export default function createToken(userId: number): string {
|
|
const key = getKey()
|
|
return jwt.sign({ userId }, key, { expiresIn: '168h' })
|
|
} |