diff --git a/src/app.monero.ts b/src/app.monero.ts new file mode 100644 index 0000000..edcaef1 --- /dev/null +++ b/src/app.monero.ts @@ -0,0 +1,40 @@ +// custom roadman +import 'cross-fetch/polyfill'; +import "reflect-metadata"; +import "dotenv/config"; + +import { Query, Resolver } from 'type-graphql'; +import { RoadmanBuild, roadman, log } from "roadman"; +import { walletRouter as moneroxWalletRouter, listenMain } from "@roadmanjs/monerox"; + +@Resolver() +class ExampleResolver { + @Query(() => [String], { nullable: true }) + async apps(): Promise { + // fake async in this example + return ['Apps', 'one', 'two']; + } +} + +const customRoadmanApp = async (args: RoadmanBuild): Promise => { + const { app } = args; + app.use("/wallet", moneroxWalletRouter()); + return args; +} + +const run = async () => { + + const roadmanStarted = await roadman({ + roadmen: [ + customRoadmanApp + ], + resolvers: [ExampleResolver] + }); + + if(roadmanStarted){ + await listenMain(); + log("roadmanStarted", roadmanStarted); + } +}; + +run(); \ No newline at end of file diff --git a/src/monerox.app.ts b/src/monerox.app.ts index 7c6be97..753d254 100644 --- a/src/monerox.app.ts +++ b/src/monerox.app.ts @@ -1,43 +1,13 @@ -// custom roadman import 'cross-fetch/polyfill'; import "reflect-metadata"; import "dotenv/config"; -import { Query, Resolver } from 'type-graphql'; -import { RoadmanBuild, roadman, log } from "roadman"; -import { walletRouter as moneroxWalletRouter, listenMain } from "@roadmanjs/monerox"; -import { siteConfigSetEnv } from "./settings/settings.methods"; - -@Resolver() -class ExampleResolver { - @Query(() => [String], { nullable: true }) - async apps(): Promise { - // fake async in this example - return ['Apps', 'one', 'two']; - } -} - -const customRoadmanApp = async (args: RoadmanBuild): Promise => { - const { app } = args; - app.use("/wallet", moneroxWalletRouter()); - return args; -} +import { get as _get } from "lodash"; +import { siteConfigSetEnv } from './settings/settings.methods'; const run = async () => { - - await siteConfigSetEnv(); - - const roadmanStarted = await roadman({ - roadmen: [ - customRoadmanApp - ], - resolvers: [ExampleResolver] - }); - - if(roadmanStarted){ - await listenMain(); - log("roadmanStarted", roadmanStarted); - } + await siteConfigSetEnv(); + await import("./app.monero"); }; -run(); \ No newline at end of file +run();