Commit 74c9439e authored by Kim, Subin's avatar Kim, Subin
Browse files

초기 관리자 계정 생성

parent 1cfd8a38
import dotenv from "dotenv" import dotenv from "dotenv"
import app from "./app.js" import app from "./app.js"
import appConfig from "./config/app.config.js" import appConfig from "./config/app.config.js"
import { sequelize } from "./db/index.js" import { sequelize, User } from "./db/index.js"
dotenv.config({ dotenv.config({
path: `${process.env.NODE_ENV === "production" ? ".env" : ".env.development" path: `${process.env.NODE_ENV === "production" ? ".env" : ".env.development"
...@@ -10,7 +10,17 @@ dotenv.config({ ...@@ -10,7 +10,17 @@ dotenv.config({
sequelize sequelize
.sync({ force: false }) .sync({ force: false })
.then(() => { .then(async () => {
await User.findOrCreate({
where: { userID: "admin" },
defaults: {
userID: "admin",
userName: "관리자",
password: "admin!",
role: "admin"
}
})
app.listen(appConfig.port, () => { app.listen(appConfig.port, () => {
console.log(`Server is running on port ${appConfig.port}`); console.log(`Server is running on port ${appConfig.port}`);
}); });
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment