Update server.js

changed sync to async