Question: how to create xsjs file?
Answer: Create a XS project as mentioned in the article Create Your First HANA XS Application using HANA Studio.
Right click on the project and select New à XS JavaScript File. ... 
Copy and paste the below code. ... 
Right click and select Team à Activate. ... 
Right click and select Run As à XS Service.