Update rest.js

added files array processing