Skip to content

Commit

Permalink
fix: loaders structure
Browse files Browse the repository at this point in the history
  • Loading branch information
junha-ahn committed Oct 18, 2023
1 parent bbd8638 commit e3850a9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
10 changes: 7 additions & 3 deletions src/api.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
const config = require('./config')
const express = require('express')
const Logger = $require('loaders/logger')
const expressLoader = $require('loaders/express')

function startServer() {
async function start() {
const app = express()

$require('loaders')(app)
await $require('loaders')()

expressLoader(app)
Logger.info('Express loaded')

app.listen(config.port, (err) => {
if (err) {
Expand All @@ -20,4 +24,4 @@ function startServer() {
module.exports = app
}

startServer()
start()
5 changes: 1 addition & 4 deletions src/loaders/index.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
const expressLoader = require('./express')
const Logger = require('./logger')
const Redis = require('./redis')

module.exports = async (app) => {
module.exports = async () => {
await Redis.connect()
Logger.info('Redis connected')
expressLoader(app)
Logger.info('Express loaded')
}

0 comments on commit e3850a9

Please sign in to comment.