Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gallolabs/application
A nodejs light framework to frame your work
https://github.com/gallolabs/application
Last synced: 29 days ago
JSON representation
A nodejs light framework to frame your work
- Host: GitHub
- URL: https://github.com/gallolabs/application
- Owner: gallolabs
- Created: 2024-01-05T18:12:48.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-02-08T19:18:51.000Z (12 months ago)
- Last Synced: 2024-02-08T20:35:56.204Z (12 months ago)
- Language: TypeScript
- Size: 106 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Gallo App
A nodejs light framework to frame your work
Application runner:
- Easy Dependencies injection
- Kill signal catched and converted to abortSignal
- Structured
- Built-in config (load from files, envs, validation, watches, etc) and logger[ ] Refactorize aborts, with aborts to interrupt, aborts to stop/clean, etc
```typescript
import { runApp } from '@gallofeliz/application'// ...
runApp({
name: '@gallofeliz/Pikatchu',
config: {
watchChanges: true,
userProvidedConfigSchema: tsToJsSchema()
},
services: {
userService({logger, db}): UserService {
return new UserService(logger, db)
},
db({config, configWatcher}): Db {
const db = new Db(config.dbPath)configWatcher.on('change:dbPath', ({value}) => db.setPath(value as string))
return db
}
},
async run({userService, logger, abortSignal, abortController}) {
userService.doAJob()
let st: NodeJS.TimeoutabortSignal.addEventListener('abort', () => {
clearTimeout(st)
console.log('clean')
userService.clean()
resolve(undefined)
})await new Promise(resolve => st = setTimeout(resolve, 5000))
abortController.abort()
}
})
```