I am using hapi-router npm module. Can not use hapi-router with typescript.
await server.register(
{
plugin: HapiRouter,
options: {
routes: "./src/api/**/routes.ts",
},
},
{ routes: { prefix: "/api/v1" } }
);
My route.ts file looks like this
import controller from "./controller";
import validator from "./validator";
export default [{
method: "GET",
path: "/products/{id}",
options: {
tags: ["api", "Products"],
description: "Get Product By ID",
validate: validator.byId
},
handler: controller.byId
}]
It gives me an error: "Can not use import statement outside a module" Even when I use require statement it doesn't work.