How do you trigger population of db on startup of app in SolidStart?
How do you trigger population of db on startup of app in SolidStart?
1 Reply
That's more like a "how do I use a database" question, not Solid specific. How you do that is really up to you. You can write code in your server entry point that will check if the DB has content, and if not the populate it.
Start here where it describes the default files, including the server entry:
https://docs.solidjs.com/solid-start/getting-started#project-files
and see a description of the server entry:
https://docs.solidjs.com/solid-start/reference/entrypoints/entry-server
Or you can do a check for existing data in your server endpoints, if you prefer:
https://docs.solidjs.com/solid-start/building-your-application/api-routes
It's really up to you. It could look like this:
entry-server.tsx - Solid Docs
Documentation for SolidJS, the signals-powered UI framework
API routes - Solid Docs
Documentation for SolidJS, the signals-powered UI framework
Getting started - Solid Docs
Documentation for SolidJS, the signals-powered UI framework