Nesting Rest Resource in Asset Listing

Bart suggested in one his post(below) to run all of JS inside the REST asset but I am not sure how.