1
0
Fork 0

worked on GarageApp stuff

This commit is contained in:
Techognito 2025-08-25 17:46:11 +02:00
parent 60aaf17af3
commit eb606572b0
51919 changed files with 2168177 additions and 18 deletions

View file

@ -1,9 +1,14 @@
import { serve } from "bun";
import index from "./index.html";
import wisher from "./wisher/index.html"
import GarageApp from "./GarageApp/index.html"
import locales from "./GarageApp/locales/index"
import wisher from "./wisher/index.html";
import GarageApp from "./GarageApp/index.html";
import locales from "./GarageApp/locales/index";
import { Database } from "bun:sqlite";
const db = new Database("src/GarageApp/hammond.db", {create: true});
// console.log(`${lng}, ${ns}`);
// console.log(process.cwd());
const server = serve({
routes: {
// Serve index.html for all unmatched routes.
@ -18,10 +23,20 @@ const server = serve({
const lng = req.params.lng;
const ns = req.params.ns;
const path = `src/GarageApp/locales/${lng}/translation.json`
console.log(`${lng}, ${ns}`);
console.log(process.cwd());
return new Response(Bun.file(path))
},
"/GarageApp/api/vehicles": async req => {
const uid = "39e9009e-50e1-4277-bbf7-69e5e0f6c6dc"
const query = db.query(
`SELECT * FROM vehicles WHERE id IN (SELECT vehicle_id FROM user_vehicles WHERE user_id='${uid}');`
);
// console.log(query.toString())
const vehicles = query.all();
// console.log(vehicles);
return Response.json(vehicles)
},
"/api/hello": {
async GET(req) {