Typescript SDK middleware route handling.
Building a project using fresh.deno and Kindes Typescript SDK. Have it setup, with pretty basic implementation. Having some issues about how to best setup the _middleware.ts file so we can create private/protected routes. Have anyone made an example for how to best implement it??. Thanks again..
2 Replies
Hey @MaDsEn as of now, we don't have a built-in feature or specific guide for setting up middleware with the Kinde TypeScript SDK in a Deno environment. The examples we have are mainly for Node.js and Next.js environments. However, you can create your own middleware function to check if a user is authenticated before accessing certain routes.
Here's a basic example of how you might do this:
Please note that this is a very basic example and might not cover all your needs. You might need to adjust it according to your application's requirements. Also, remember to replace the placeholders with your actual Kinde credentials.
Thank you for the respons. Will check it out👍. It was just easier if someone had made an example,😊 but have a few ideas that might work for a more structured project.