Split '/endpoints' to a controller. Added tests.