Node.js doesn’t seem to support directory imports based on this documentation. You have to explicitly point to your .js file for example:
import …from “./database/index.js”
You may also find the suggestions in this old SO post helpful for your case.