nirix / nanite

Simple "framework"
http://nirix.github.io/nanite/
62 stars 12 forks source link

Handling 404 #2

Closed jzush closed 9 years ago

jzush commented 9 years ago

How do I handle 404 (not found) errors?

Thanks.

nirix commented 9 years ago

The current way of handling 404 errors is to check if the route has been processed after every other route.

<?php
get('/', ...);
get('/something/else', ...);
get('/something/different', ...);

....

// Now check if route has been processed
if (!Nanite::$routeProccessed) {
    // display 404
}

I would like to provide a proper way, such as Nanite::set404(...) but would also like to keep Nanite as small and fast as possible. I have a few ideas I've been playing around with and should have something soon.

jzush commented 9 years ago

Oh sweet. Thank you