API
Protect API endpoints
Learn how to protect your API endpoints in your SuperStarter application.
Check if the user is authenticated
To protect your API endpoints, you can use the honoAuthMiddlewareWrap
in your router or on a specific endpoint.
hello/index.ts
The middlware will throw an error if the user is not authenticated.
The honoAuthMiddlewareWrap
will also provide the auth
infromation to the endpoint. If the handler is reached, both objects are available in the auth
.
hello/index.ts