simple-fs-server/dev.ts

19 lines
524 B
TypeScript
Raw Normal View History

2023-01-05 18:18:07 +09:00
#!/usr/bin/env -S deno run -A --watch=static/,routes/
2023-01-14 03:03:22 +09:00
import { connectDB } from "./src/user/db.ts";
import * as users from "./src/user/user.ts";
2023-01-05 18:18:07 +09:00
2023-01-14 03:03:22 +09:00
import dev from "$fresh/dev.ts";
await devUserAdd();
2023-01-05 18:18:07 +09:00
await dev(import.meta.url, "./main.ts");
2023-01-14 03:03:22 +09:00
async function devUserAdd() {
2023-01-14 03:03:58 +09:00
if (Deno.env.get("DB_PATH") === ":memory:") {
const db = await connectDB();
const username = "admin";
const password = "admin";
const new_user = await users.createUser(username, password);
await users.addUser(db, new_user);
}
}