'Failed to load resource: the server responded with a status of 404 (Not Found) Sqlite3.js
I am trying to load an sqlite3 package to the browser using requirejs module and and it won't load.
This is the code of the JavaScript file:
requirejs(['sqlite3'], function (sqlite3) {
// const sqlite3 = require('sqlite3').verbose();
let db = new sqlite3.Database('./db/main.db');
const button = document.querySelector("#btnOnclick");
const fname = document.querySelector("#fname");
button.addEventListener("click", function onclick(event) {
db.run(`INSERT INTO langs(name) VALUES(?)`, [fname], function(err) {
if (err) {
return console.log(err.message);
}
// get the last insert id
console.log(`A row has been inserted with rowid ${this.lastID}`);
});
db.close();
});
});
and it gives me theis error in the browser console:
screenshot of the browser console
Note:
I am using nodeJs and html & css for this project and the code works fine in my machine but on the browser gives me this error
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
