import * as express from "express" ; import { Merror , MerrorMiddleware } from "../dist/index" ; const app = express ( ) ; const router = express . Router ( ) ; app . use ( "/" , router ) ; router . get ( "/profile" , function ( req , res , next ) { return next ( new Merror ( 401 , "Unauthorized Access! Custom Message!" , { code : 1001 , status : "REFRESH_TOKEN" } ) ) ; } ) ; app . use ( MerrorMiddleware ( ) ) ; app . listen ( 3000 , ( ) => console . log ( "Example app listening on port 3000!" ) ) ;