JS Lab 4
This commit is contained in:
@@ -0,0 +1,25 @@
|
|||||||
|
USE mynorthwind;
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS invoices (
|
||||||
|
invoiceId INT AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
customer VARCHAR(5) NOT NULL,
|
||||||
|
amount INT NOT NULL,
|
||||||
|
date DATE NOT NULL,
|
||||||
|
FOREIGN KEY (customer) REFERENCES customers(CustomerID)
|
||||||
|
);
|
||||||
|
|
||||||
|
INSERT INTO invoices (customer, amount, date) VALUES ('ANATR', 250, '2026-01-06');
|
||||||
|
INSERT INTO invoices (customer, amount, date) VALUES ('ANTON', 375, '2026-01-02');
|
||||||
|
INSERT INTO invoices (customer, amount, date) VALUES ('ALFKI', 125, '2026-01-25');
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS returns (
|
||||||
|
returnId INT AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
customer VARCHAR(5) NOT NULL,
|
||||||
|
amount INT NOT NULL,
|
||||||
|
date DATE NOT NULL,
|
||||||
|
FOREIGN KEY (customer) REFERENCES customers(CustomerID)
|
||||||
|
);
|
||||||
|
|
||||||
|
INSERT INTO returns (customer, amount, date) VALUES ('ANATR', 111, '2026-02-12');
|
||||||
|
INSERT INTO returns (customer, amount, date) VALUES ('ANTON', 950, '2026-02-26');
|
||||||
|
INSERT INTO returns (customer, amount, date) VALUES ('ALFKI', 10205, '2026-03-01');
|
||||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,3 @@
|
|||||||
|
console.log("Hello Node.js");
|
||||||
|
console.log("Welcome to Node.js Lab");
|
||||||
|
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
console.log("Start");
|
||||||
|
setTimeout(() => {
|
||||||
|
console.log("This runs after 2 seconds");
|
||||||
|
}, 2000);
|
||||||
|
console.log("End");
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
function fetchData() {
|
||||||
|
return new Promise((resolve) => {
|
||||||
|
setTimeout(() => {
|
||||||
|
resolve("Data received");
|
||||||
|
}, 2000);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async function displayData() {
|
||||||
|
const data = await fetchData();
|
||||||
|
console.log(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
displayData();
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
const fs = require("fs");
|
||||||
|
|
||||||
|
fs.writeFileSync("test.txt", "Hello from Node.js");
|
||||||
|
|
||||||
|
console.log("File created successfully!");
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
const os = require("os");
|
||||||
|
|
||||||
|
console.log("Operating System:", os.platform());
|
||||||
|
console.log("CPU Architecture:", os.arch());
|
||||||
|
console.log("Total Memory:", os.totalmem());
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
const http = require("http");
|
||||||
|
const server = http.createServer((req, res) => {
|
||||||
|
res.writeHead(200, { "Content-Type": "text/plain" });
|
||||||
|
res.end("Hello from Node.js Web Server! My Name is Levi");
|
||||||
|
});
|
||||||
|
|
||||||
|
server.listen(3000, () => {
|
||||||
|
console.log("Server running at http://localhost:3000");
|
||||||
|
});
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
Hello from Node.js
|
||||||
Binary file not shown.
@@ -29,7 +29,6 @@
|
|||||||
<input type="number" placeholder="MaxYear" name="maxYearInput" id="maxYearInput">
|
<input type="number" placeholder="MaxYear" name="maxYearInput" id="maxYearInput">
|
||||||
|
|
||||||
<button type="submit" value="Filter By Year" name="yearFilterBtn" onclick="filterByYear()">Filter By Year</button>
|
<button type="submit" value="Filter By Year" name="yearFilterBtn" onclick="filterByYear()">Filter By Year</button>
|
||||||
|
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
<!-- Filter by name stuff -->
|
<!-- Filter by name stuff -->
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ function fetchJson() {
|
|||||||
.then(data => {
|
.then(data => {
|
||||||
console.log(data);
|
console.log(data);
|
||||||
const tableBody = document.getElementById("meteorTableBody");
|
const tableBody = document.getElementById("meteorTableBody");
|
||||||
data.forEach(meteor => { // Just get 500 values for now
|
data.splice(0,35).forEach(meteor => { // Just get 500 values for now
|
||||||
const row = document.createElement("tr");
|
const row = document.createElement("tr");
|
||||||
const id = document.createElement("td");
|
const id = document.createElement("td");
|
||||||
id.textContent = meteor.id ?? "-";
|
id.textContent = meteor.id ?? "-";
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ function loadMap() {
|
|||||||
fetch("./js/Meteorite_Landings.json")
|
fetch("./js/Meteorite_Landings.json")
|
||||||
.then((response) => response.json())
|
.then((response) => response.json())
|
||||||
.then(data => {
|
.then(data => {
|
||||||
meteorData = data.splice(0,500);
|
meteorData = data.splice(0,35);
|
||||||
filteredData = [...meteorData];
|
filteredData = [...meteorData];
|
||||||
drawMarkers(filteredData);
|
drawMarkers(filteredData);
|
||||||
})
|
})
|
||||||
|
|||||||
Binary file not shown.
Reference in New Issue
Block a user