npm i @duplojs/http-exception
import Duplo from "@duplojs/duplojs";
import duploHttpException, {OkHttpException} from "@duplojs/http-exception";
const duplo = Duplo({port: 1506, host: "localhost", environment: "DEV"});
duplo.use(duploHttpException);
duplo.declareRoute("GET", "/")
.handler(() => {
throw new OkHttpException("successful", "hello-world");
});
duplo.launch();
duplo.use(duploHttpException, {
...
globals: true
});
tsconfig.json
{
"compilerOptions": {
...
"types": [
"@duplojs/http-exception/globals"
],
}
}