Skip to content

Commit

Permalink
Merge pull request #24 from AthennaIO/develop
Browse files Browse the repository at this point in the history
feat: update packages
  • Loading branch information
jlenon7 authored Apr 8, 2022
2 parents bb6598e + 9bf38cf commit b397acb
Show file tree
Hide file tree
Showing 8 changed files with 38 additions and 70 deletions.
4 changes: 0 additions & 4 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,3 @@
export * from 'src/Facade'
export * from 'src/Ignite'
export * from 'src/Application'

export * from 'src/Facades/Log'
export * from 'src/Facades/HttpRoute'
export * from 'src/Facades/HttpServer'
36 changes: 18 additions & 18 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@athenna/core",
"version": "1.2.1",
"version": "1.2.2",
"description": "",
"license": "MIT",
"author": "João Lenon <[email protected]>",
Expand Down Expand Up @@ -160,8 +160,8 @@
"dependencies": {
"@athenna/config": "1.0.8",
"@athenna/ioc": "1.1.2",
"@athenna/logger": "1.1.4",
"@athenna/http": "1.2.0",
"@athenna/logger": "1.1.6",
"@athenna/http": "1.2.1",
"@secjs/utils": "1.8.3",
"reflect-metadata": "0.1.13",
"tscpaths": "0.0.9"
Expand Down
21 changes: 16 additions & 5 deletions src/Application.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,21 @@

import { parse } from 'path'
import { Ioc } from '@athenna/ioc'
import { Log } from 'src/Facades/Log'
import { Logger } from '@athenna/logger'
import { Path, resolveModule } from '@secjs/utils'
import { Http, Router as HttpRoute } from '@athenna/http'
import { NotBootedException } from 'src/Exceptions/NotBootedException'
import { AlreadyBootedException } from 'src/Exceptions/AlreadyBootedException'
import { AlreadyShutdownException } from 'src/Exceptions/AlreadyShutdownException'

export class Application {
/**
* Simple logger for Application class.
*
* @private
*/
private logger: Logger

/**
* An instance of the Ioc class that is a Monostate with
* the Awilix container inside.
Expand Down Expand Up @@ -98,6 +105,10 @@ export class Application {
* @return void
*/
async bootHttpServer(): Promise<Http> {
if (!this.logger) {
this.logger = resolveModule(await import('./Utils/Logger'))
}

if (this.httpServer) {
throw new AlreadyBootedException('HttpServer')
}
Expand All @@ -124,7 +135,7 @@ export class Application {

await this.httpServer.listen(port, host)

Log.success(`Http server started on http://${host}:${port}`)
this.logger.success(`Http server started on http://${host}:${port}`)

return this.httpServer
}
Expand All @@ -139,7 +150,7 @@ export class Application {
throw new AlreadyShutdownException('HttpServer')
}

Log.warn(`Http server shutdown, bye! :)`)
this.logger.warn(`Http server shutdown, bye! :)`)

await this.httpServer.close()

Expand All @@ -158,7 +169,7 @@ export class Application {
private async preloadFile(filePath: string) {
const { dir, name } = parse(filePath)

Log.success(`Preloading ${name} file`)
this.logger.success(`Preloading ${name} file`)

await import(`${dir}/${name}${this.extension}`)
}
Expand All @@ -175,7 +186,7 @@ export class Application {
await import(`${dir}/${name}${this.extension}`),
)

Log.success('Booting the Http Kernel')
this.logger.success('Booting the Http Kernel')

await new HttpKernel().registerMiddlewares()
}
Expand Down
13 changes: 0 additions & 13 deletions src/Facades/HttpRoute.ts

This file was deleted.

13 changes: 0 additions & 13 deletions src/Facades/HttpServer.ts

This file was deleted.

13 changes: 0 additions & 13 deletions src/Facades/Log.ts

This file was deleted.

2 changes: 1 addition & 1 deletion tests/Stubs/routes/http.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Route } from 'src/Facades/HttpRoute'
import { Route } from '@athenna/http'

Route.get('/healthcheck', ({ response }) => {
return response.status(200).send({ status: 'ok' })
Expand Down

0 comments on commit b397acb

Please sign in to comment.