Execute a function every time my server renders/serves a page?
Unanswered
Transvaal lion posted this in #help-forum
Transvaal lionOP
Is there a way to execute a function every time my server renders/serves a page to count how many times a route was hit in next?
4 Replies
@Transvaal lion Is there a way to execute a function every time my server renders/serves a page to count how many times a route was hit in next?
a view count?
you may want to check [this code](https://github.com/leerob/leerob.io/blob/9a68ec0f3c5eceb09f1ab5484a6b4175567f1449/app/blog/%5Bslug%5D/page.tsx#L139) from Lee's blog
you may want to check [this code](https://github.com/leerob/leerob.io/blob/9a68ec0f3c5eceb09f1ab5484a6b4175567f1449/app/blog/%5Bslug%5D/page.tsx#L139) from Lee's blog
look up middleware
@linesofcode look up middleware
Transvaal lionOP
thanks