Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
students
butter-studio
Commits
e1796752
Commit
e1796752
authored
Jul 12, 2021
by
Jiwon Yoon
Browse files
Merge branch 'kimpen'
parents
7578fa34
3aafc3b2
Changes
23
Hide whitespace changes
Inline
Side-by-side
server/db/index.js
0 → 100644
View file @
e1796752
import
{
Sequelize
}
from
"
sequelize
"
;
import
dbConfig
from
"
../config/db.config.js
"
;
const
sequelize
=
new
Sequelize
(
String
(
dbConfig
.
database
),
String
(
dbConfig
.
username
),
dbConfig
.
password
,
{
host
:
dbConfig
.
host
,
dialect
:
dbConfig
.
dialect
,
pool
:
{
max
:
dbConfig
.
pool
?.
max
,
min
:
dbConfig
.
pool
?.
min
,
acquire
:
dbConfig
.
pool
?.
acquire
,
idle
:
dbConfig
.
pool
?.
idle
,
},
}
);
export
{
sequelize
,
}
\ No newline at end of file
server/index.js
View file @
e1796752
import
dotenv
from
"
dotenv
"
;
import
{
sequelize
}
from
"
./db/index.js
"
;
import
app
from
"
./app.js
"
;
import
appConfig
from
"
./config/app.config.js
"
;
dotenv
.
config
({
path
:
`
${
process
.
env
.
NODE_ENV
===
"
production
"
?
"
.env
"
:
"
.env.development
"
}
`
,
});
sequelize
.
sync
({
force
:
true
})
.
then
(
async
()
=>
{
// await Promise.all(
// Object.keys(ROLE_NAME).map((name) => {
// return Role.create({ name });
// })
// );
// const adminRole = await Role.findOne({ where: { name: "admin" } });
// await User.create({
// name: "admin",
// email: "admin@example.com",
// password: "admin!",
// isMember: true,
// roleId: adminRole?.id,
// });
app
.
listen
(
appConfig
.
port
,
()
=>
{
console
.
log
(
`Server is running on port
${
appConfig
.
port
}
`
);
});
})
.
catch
((
err
)
=>
{
console
.
log
(
err
);
});
server/routes/index.js
0 → 100644
View file @
e1796752
import
express
from
"
express
"
;
const
router
=
express
.
Router
();
export
default
router
;
\ No newline at end of file
Prev
1
2
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment