Skip to content

Commit

Permalink
feat: added to coresettings
Browse files Browse the repository at this point in the history
  • Loading branch information
pclokcer committed May 2, 2024
1 parent 98c6ea8 commit 7e9d270
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ A lightweight Node.js and TypeScript dependency injection framework powered [tsy
### Table of Contents
- [Installation](#installation)
- [Quick Start](#quick-start)
- [coreSettings](#coresettings)
- [Decorators](#decorators)
- [Controller()](#controller)
- [Get(), Post(), Put(), Delete(), Head(), Patch(), Options()](#get-post-put-delete-head-patch-options)
Expand All @@ -22,6 +23,7 @@ A lightweight Node.js and TypeScript dependency injection framework powered [tsy
- [Events](#events)
- [EndpointOptions](#endpointoptions)


## Installation

```sh
Expand Down Expand Up @@ -62,13 +64,16 @@ export default class ResponseModel<T> {

```typescript
// application.ts
import { Modules, PermissionModule, HandleErrorResponse, DataSource, dataSourceList, EventsModules } from "helocore";
import { Modules, PermissionModule, HandleErrorResponse, DataSource, dataSourceList, EventsModules, coreSettings } from "helocore";
import TestController from './TestController'
import PermissionControl from './PermissionControl'
import Redis from './Redis'
import ResponseModel from './ResponseModel'
import EventsTest from './Events'

// default true
coreSettings.logger = false

// Controller layer defining
Modules([
TestController
Expand Down Expand Up @@ -118,6 +123,10 @@ fastify.register((app, _, done) => {
fastify.listen({ port: 3000 }, () => console.log('API is Running'))
```

## coreSettings

- **logger**: helocore logger with trace_id to command prompt. it can reachable from `req.trace_id`

## Decorators

### Controller()
Expand Down
4 changes: 3 additions & 1 deletion example/application.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { HandleErrorResponse, Modules, EventsModule } from "helocore"
import { HandleErrorResponse, Modules, EventsModule, coreSettings } from "helocore"

import UploadController from "./src/controllers/UploadController"
import EventController from "./src/controllers/EventController"
import ServiceResponse from "./src/models/ServiceResponse"
import { handleError } from "./src/modules/HandleError"
import EventTest from "./src/events/Events"

coreSettings.logger = true

Modules([
UploadController,
EventController
Expand Down
3 changes: 3 additions & 0 deletions src/Settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,8 @@ export const coreSettings: TSettings = {
}

type TSettings = {
/**
* Default true
*/
logger: boolean
}

0 comments on commit 7e9d270

Please sign in to comment.