index.js in client side written and repaired