How to configure routes for authentication w keycloak, nodejs and UI5

How do you configure a routes for a nodejs backend and ui5 frontend application?
I have a UI5 frontend with like login, logout and other functions and i want to redirect all traffic through keycloak and then upon successful authentication i want to redirect to the initial destination. how can i use keycloak to do authentication and check token in subsequent authentication?
i know keycloak has some “protect()” method but how do you configure the routes to handle redirects?