I have a .db file made using sqlite that contains information about stories that were scraped from the internet (title, author, summary, file path, .etc).
I plan for all the story files to be in one folder and then use the database to show them on html webpages and what not.
Like a page with a list of authors, and when you click an authors name, it would go to a page with a list of stories, and it would access the database to get that information.
It would only be on something that’s run on my computer, not connected to the internet or anything so I don’t want a server. The reason why i would like it ot be serverless because i want my friends to use the program without having to worry about trying to set up a server or anything.
i know php can interact with sql but it seems to need a sever, and i know there’s some java script libraies that can work with sql, but i’m not sure if js can access the files or create the necessary pages
Honestly am just looking where to start. I just want to be able to click on a link and see what stories were saved.
2
Answers
Short answer, no. JavaScript which runs client-side (which is anything loaded by a webpage or HTML document locally) can not load files without user interaction. Say, opening the .db file. Every time. While it is technically possible, I wouldn’t recommend it due to the load you’d place on the tab in your browser by keeping the contents of that file loaded.
With that being said, I know you have implied that you’d want to utilise the sqlite db file directly in a webpage. I’d personally recommend an application route, which can display your files consistently if you understandably don’t want to run a server. Something like Electron may be of use, which can utilise the file and still follow a HTML structure that you might be familiar with.
Apologies that this might not be the answer you were looking for specifically, but I hope this could help as you’ve said you’re looking for a place to start 🙂
The only thing you might be able to do here, is let your user pick a file with a
<input type="file" />
and parse that file, and later on let the user save the file again by triggering a download.Using sqlite for this may be unpractical though.