Taken from npm docs npm supports the "scripts" property of package.json script, one of which is prestart, so you might have package.json
{ "scripts" :
{
"prestart" : "node scripts/mysqlCheck.js",
"start" : "node index.js"
}
}
mysqlCheck.js MySQL DB. , npm start, prestart script index.js.