@_tc/template-core 0.0.1-bate.21 → 0.0.1-bate.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const getViewController = (app) => class ViewController {
4
4
  async renderPage(ctx) {
5
- app.extends.renderView(`/dist/${ctx.params.page}.entry.tpl`, ctx, {
5
+ app.extends.renderView(`dist/${ctx.params.page}.entry.tpl`, ctx, {
6
6
  projKey: ctx.query.proj_key,
7
7
  name: app.options?.name,
8
8
  env: app.envs.get(),
@@ -7,8 +7,7 @@ const paths_1 = require("../../packages/core/paths");
7
7
  const nunjucks_1 = __importDefault(require("nunjucks"));
8
8
  const path_1 = __importDefault(require("path"));
9
9
  exports.default = (app) => {
10
- const viewsPath = path_1.default.join((0, paths_1.getAppPath)(app, "frame"), "./public");
11
- console.log(viewsPath);
10
+ const viewsPath = path_1.default.join((0, paths_1.getAppPath)(app, "business"), "./public");
12
11
  const env = nunjucks_1.default.configure(viewsPath, {
13
12
  autoescape: true,
14
13
  throwOnUndefined: false,
@@ -19,10 +18,6 @@ exports.default = (app) => {
19
18
  });
20
19
  app.extends.nunjucksEnv = env;
21
20
  return (view, ctx, context) => {
22
- console.log("view ---- >", view);
23
- console.log(env.options);
24
- console.log(env.opts);
25
- console.log(env.loaders[0]);
26
21
  ctx.body = env.render(view, Object.assign({}, ctx.state, context));
27
22
  };
28
23
  };
@@ -50,7 +50,8 @@ exports.default = (app) => {
50
50
  ctx.redirect(executionResults ?? "/");
51
51
  }
52
52
  else {
53
- ctx.redirect(app.options?.homePage ?? "/");
53
+ ctx.status = 404;
54
+ ctx.body = "notFound";
54
55
  }
55
56
  // throw new Error();
56
57
  return;
@@ -1,6 +1,6 @@
1
1
  const getViewController = (app) => class ViewController {
2
2
  async renderPage(ctx) {
3
- app.extends.renderView(`/dist/${ctx.params.page}.entry.tpl`, ctx, {
3
+ app.extends.renderView(`dist/${ctx.params.page}.entry.tpl`, ctx, {
4
4
  projKey: ctx.query.proj_key,
5
5
  name: app.options?.name,
6
6
  env: app.envs.get(),
@@ -2,8 +2,7 @@ import { getAppPath } from "../../packages/core/paths";
2
2
  import nunjucks from "nunjucks";
3
3
  import path from "path";
4
4
  export default (app) => {
5
- const viewsPath = path.join(getAppPath(app, "frame"), "./public");
6
- console.log(viewsPath);
5
+ const viewsPath = path.join(getAppPath(app, "business"), "./public");
7
6
  const env = nunjucks.configure(viewsPath, {
8
7
  autoescape: true,
9
8
  throwOnUndefined: false,
@@ -14,10 +13,6 @@ export default (app) => {
14
13
  });
15
14
  app.extends.nunjucksEnv = env;
16
15
  return (view, ctx, context) => {
17
- console.log("view ---- >", view);
18
- console.log(env.options);
19
- console.log(env.opts);
20
- console.log(env.loaders[0]);
21
16
  ctx.body = env.render(view, Object.assign({}, ctx.state, context));
22
17
  };
23
18
  };
@@ -45,7 +45,8 @@ export default (app) => {
45
45
  ctx.redirect(executionResults ?? "/");
46
46
  }
47
47
  else {
48
- ctx.redirect(app.options?.homePage ?? "/");
48
+ ctx.status = 404;
49
+ ctx.body = "notFound";
49
50
  }
50
51
  // throw new Error();
51
52
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@_tc/template-core",
3
- "version": "0.0.1-bate.21",
3
+ "version": "0.0.1-bate.23",
4
4
  "description": "A TypeScript Koa framework template - Monorepo root",
5
5
  "main": "./index.js",
6
6
  "types": "./index.d.ts",