code for PAT in Javascript(nodeJs)