Making a new api from scratch is annoying. Just use this. Ez PZ. You can 1 to 1 follow this pattern for a vanilla javascript api as well. This approach very testable and easy to work with.
bin/www houses the starter code. You can run this via:
clone repo
npm i
npm start
*magic*
This gives you a barebones minimally functional restful web service or microservice. It includes full test integration and everything so you can go literally from this to a production level application.
You need docker installed to use the provided db, which is only a toy example