API endpoint refactoring: added /ui prefix to API dedicated to JavaScript front-end; Added some unit tests