mirror of
https://github.com/detleph/server.git
synced 2026-09-04 08:36:06 +02:00
Add code that ensures that an (admin) user is always present
This commit is contained in:
@@ -2,12 +2,20 @@ import express from "express";
|
||||
import prisma from "./lib/prisma";
|
||||
import eventRouter from "./Routes/event.routes";
|
||||
import adminAuthRouter from "./Routes/admin_auth.routes";
|
||||
import argon2 from "argon2";
|
||||
|
||||
require("dotenv").config(); // Load dotenv config
|
||||
|
||||
const app = express();
|
||||
|
||||
async function main() {
|
||||
// Dev
|
||||
await prisma.admin.upsert({
|
||||
where: { id: 1 },
|
||||
create: { name: "admin", password: await argon2.hash("test", { type: argon2.argon2id }) },
|
||||
update: {},
|
||||
});
|
||||
|
||||
// Todo: Everything
|
||||
|
||||
// Bodyparser and urlencoded to parse post request bodies
|
||||
|
||||
Reference in New Issue
Block a user