Improve importing of the app object within JDD components - see https://forum.sealcode.org/t/how-to-use-sealious-app-orm-methods-in-jdd/1979
This commit is contained in:
parent
83fdab8ac7
commit
097a283ace
8
package-lock.json
generated
8
package-lock.json
generated
@ -15,7 +15,7 @@
|
|||||||
"@koa/router": "^12.0.1",
|
"@koa/router": "^12.0.1",
|
||||||
"@playwright/test": "^1.36.1",
|
"@playwright/test": "^1.36.1",
|
||||||
"@sealcode/jdd": "^0.3.4",
|
"@sealcode/jdd": "^0.3.4",
|
||||||
"@sealcode/sealgen": "^0.14.5",
|
"@sealcode/sealgen": "^0.14.6",
|
||||||
"@sealcode/ts-predicates": "^0.4.3",
|
"@sealcode/ts-predicates": "^0.4.3",
|
||||||
"@types/kill-port": "^2.0.0",
|
"@types/kill-port": "^2.0.0",
|
||||||
"@types/leaflet": "^1.9.8",
|
"@types/leaflet": "^1.9.8",
|
||||||
@ -860,9 +860,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@sealcode/sealgen": {
|
"node_modules/@sealcode/sealgen": {
|
||||||
"version": "0.14.5",
|
"version": "0.14.6",
|
||||||
"resolved": "https://registry.npmjs.org/@sealcode/sealgen/-/sealgen-0.14.5.tgz",
|
"resolved": "https://registry.npmjs.org/@sealcode/sealgen/-/sealgen-0.14.6.tgz",
|
||||||
"integrity": "sha512-SE3dpS5KAsvpznKJla1VoqlnDNxeHJ2mTN2Kzdwg9Chleht/Mw/ojb7E58ZX/WxJNg+BRuCYy6knJkvkO7SfQg==",
|
"integrity": "sha512-zVK52Y6wqLX0pGpD9WtNlBEURDG7pn/9FImtn2FpRZJxilXUgqI8t63Z3+ouwj3kDJ+DW5VXhlaxsMnUChxO4Q==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@koa/router": "^12.0.1",
|
"@koa/router": "^12.0.1",
|
||||||
"@sealcode/ts-predicates": "^0.4.3",
|
"@sealcode/ts-predicates": "^0.4.3",
|
||||||
|
@ -36,7 +36,7 @@
|
|||||||
"@koa/router": "^12.0.1",
|
"@koa/router": "^12.0.1",
|
||||||
"@playwright/test": "^1.36.1",
|
"@playwright/test": "^1.36.1",
|
||||||
"@sealcode/jdd": "^0.3.4",
|
"@sealcode/jdd": "^0.3.4",
|
||||||
"@sealcode/sealgen": "^0.14.5",
|
"@sealcode/sealgen": "^0.14.6",
|
||||||
"@sealcode/ts-predicates": "^0.4.3",
|
"@sealcode/ts-predicates": "^0.4.3",
|
||||||
"@types/kill-port": "^2.0.0",
|
"@types/kill-port": "^2.0.0",
|
||||||
"@types/leaflet": "^1.9.8",
|
"@types/leaflet": "^1.9.8",
|
||||||
|
@ -1,27 +1,25 @@
|
|||||||
import kill from "kill-port";
|
import kill from "kill-port";
|
||||||
import type { KoaResponsiveImageRouter } from "koa-responsive-image-router";
|
|
||||||
import _locreq from "locreq";
|
import _locreq from "locreq";
|
||||||
import { FlatTemplatable } from "tempstream";
|
|
||||||
import TheApp from "./app.js";
|
import TheApp from "./app.js";
|
||||||
import { PORT, SEALIOUS_SANITY } from "./config.js";
|
import { PORT, SEALIOUS_SANITY } from "./config.js";
|
||||||
import { mainRouter } from "./routes/index.js";
|
import { mainRouter } from "./routes/index.js";
|
||||||
import { module_dirname } from "./util.js";
|
import { module_dirname } from "./util.js";
|
||||||
const locreq = _locreq(module_dirname(import.meta.url));
|
const locreq = _locreq(module_dirname(import.meta.url));
|
||||||
|
|
||||||
const app = new TheApp();
|
export const the_app = new TheApp();
|
||||||
|
|
||||||
void (async function () {
|
void (async function () {
|
||||||
await kill(PORT);
|
await kill(PORT);
|
||||||
await kill(PORT);
|
await kill(PORT);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
app.HTTPServer.addStaticRoute("/", locreq.resolve("public"));
|
the_app.HTTPServer.addStaticRoute("/", locreq.resolve("public"));
|
||||||
await app.start();
|
await the_app.start();
|
||||||
if (SEALIOUS_SANITY) {
|
if (SEALIOUS_SANITY) {
|
||||||
console.error("Exiting with error code 0");
|
console.error("Exiting with error code 0");
|
||||||
process.exit(0);
|
process.exit(0);
|
||||||
}
|
}
|
||||||
mainRouter(app.HTTPServer.router);
|
mainRouter(the_app.HTTPServer.router);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
if (SEALIOUS_SANITY) {
|
if (SEALIOUS_SANITY) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user