Refactor units to be generic; start bundles; start app index.ts
This commit is contained in:
2
app/bundle/daton.ts
Normal file
2
app/bundle/daton.ts
Normal file
@@ -0,0 +1,2 @@
|
||||
export * from '../../lib/src/module.ts'
|
||||
export * from '../../di/module.ts'
|
||||
4
app/bundle/daton_units.ts
Normal file
4
app/bundle/daton_units.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
export { default as ConfigUnit } from '../../lib/src/unit/Config.ts'
|
||||
export { DatabaseUnit } from '../../orm/src/DatabaseUnit.ts'
|
||||
export { default as ControllerUnit } from '../../lib/src/unit/Controllers.ts'
|
||||
export { default as MiddlewareUnit } from '../../lib/src/unit/Middlewares.ts'
|
||||
5
app/configs/app.config.ts
Normal file
5
app/configs/app.config.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
import { env } from '../../lib/src/unit/Scaffolding.ts';
|
||||
|
||||
export default {
|
||||
name: env('APP_NAME', 'Daton'),
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
import { env } from '../../../lib/src/unit/Scaffolding.ts';
|
||||
|
||||
export default {
|
||||
name: env('APP_NAME', 'Daton'),
|
||||
}
|
||||
16
app/configs/db.config.ts
Normal file
16
app/configs/db.config.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import {env} from "../../lib/src/unit/Scaffolding.ts";
|
||||
|
||||
export default {
|
||||
|
||||
connections: {
|
||||
default: {
|
||||
type: env('DB_TYPE', 'postgres'),
|
||||
user: env('DB_USERNAME', 'daton'),
|
||||
password: env('DB_PASSWORD'),
|
||||
database: env('DB_DATABASE', 'daton'),
|
||||
hostname: env('DB_HOSTNAME', 'localhost'),
|
||||
port: env('DB_PORT', 5432),
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
20
app/index.ts
Executable file
20
app/index.ts
Executable file
@@ -0,0 +1,20 @@
|
||||
#!/usr/bin/env -S deno run -c ./tsconfig.json --unstable --allow-read --allow-env --allow-net
|
||||
/* Main executable for the Daton app. */
|
||||
|
||||
import { make, Scaffolding, Application } from './bundle/daton.ts'
|
||||
import units from './units.ts'
|
||||
|
||||
/*
|
||||
* Let's get up and running. The scaffolding provides the bare minimum
|
||||
* amount of support required to get Daton up and running. The app handles
|
||||
* the rest.
|
||||
*/
|
||||
const scaffolding = make(Scaffolding)
|
||||
await scaffolding.up()
|
||||
|
||||
/*
|
||||
* Now, import the units and start the application. The units define each
|
||||
* modular piece of functionality that is managed by the Daton app.
|
||||
*/
|
||||
const app = make(Application, units)
|
||||
await app.run()
|
||||
8
app/tsconfig.json
Executable file
8
app/tsconfig.json
Executable file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"experimentalDecorators": true,
|
||||
"emitDecoratorMetadata": true
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
8
app/units.ts
Normal file
8
app/units.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
import {ConfigUnit, DatabaseUnit, ControllerUnit, MiddlewareUnit} from './bundle/daton_units.ts'
|
||||
|
||||
export default [
|
||||
ConfigUnit,
|
||||
DatabaseUnit,
|
||||
MiddlewareUnit,
|
||||
ControllerUnit,
|
||||
]
|
||||
Reference in New Issue
Block a user