add index.js && refact npm run api command