speedly 2.0.8 → 2.0.10

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.
@@ -1,6 +1,7 @@
1
1
  import express from "express";
2
2
  type InitConfig = {
3
3
  notFoundHandler?: boolean;
4
+ homeHandler?: boolean;
4
5
  errorHandler?: boolean;
5
6
  jsonParser?: boolean;
6
7
  urlEncodedParser?: boolean;
@@ -5,9 +5,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.default = speedly;
7
7
  const express_1 = __importDefault(require("express"));
8
+ const path_1 = __importDefault(require("path"));
8
9
  const defaultConfig = {
9
10
  notFoundHandler: true,
10
11
  errorHandler: true,
12
+ homeHandler: true,
11
13
  jsonParser: true,
12
14
  urlEncodedParser: true,
13
15
  cookieParser: true,
@@ -33,6 +35,13 @@ function speedly(config = {}) {
33
35
  }
34
36
  if (finalConfig.staticFiles)
35
37
  app.use("/static", express_1.default.static("public"));
38
+ if (finalConfig.homeHandler) {
39
+ app.get("/", (req, res) => {
40
+ res.send(`<h1>Welcome to ${require(path_1.default.join(process.cwd(), "package.json")).name} App</h1>
41
+ <p>Your app is running successfully.</p>
42
+ <p>Visit <a href="/docs">/docs</a> for API documentation.</p>`);
43
+ });
44
+ }
36
45
  // user can call this manually if needed
37
46
  const registerFallbacks = () => {
38
47
  if (finalConfig.notFoundHandler) {
@@ -1,6 +1,7 @@
1
1
  import express from "express";
2
2
  type InitConfig = {
3
3
  notFoundHandler?: boolean;
4
+ homeHandler?: boolean;
4
5
  errorHandler?: boolean;
5
6
  jsonParser?: boolean;
6
7
  urlEncodedParser?: boolean;
@@ -5,9 +5,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.default = speedly;
7
7
  const express_1 = __importDefault(require("express"));
8
+ const path_1 = __importDefault(require("path"));
8
9
  const defaultConfig = {
9
10
  notFoundHandler: true,
10
11
  errorHandler: true,
12
+ homeHandler: true,
11
13
  jsonParser: true,
12
14
  urlEncodedParser: true,
13
15
  cookieParser: true,
@@ -33,6 +35,13 @@ function speedly(config = {}) {
33
35
  }
34
36
  if (finalConfig.staticFiles)
35
37
  app.use("/static", express_1.default.static("public"));
38
+ if (finalConfig.homeHandler) {
39
+ app.get("/", (req, res) => {
40
+ res.send(`<h1>Welcome to ${require(path_1.default.join(process.cwd(), "package.json")).name} App</h1>
41
+ <p>Your app is running successfully.</p>
42
+ <p>Visit <a href="/docs">/docs</a> for API documentation.</p>`);
43
+ });
44
+ }
36
45
  // user can call this manually if needed
37
46
  const registerFallbacks = () => {
38
47
  if (finalConfig.notFoundHandler) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "speedly",
3
- "version": "2.0.8",
3
+ "version": "2.0.10",
4
4
  "main": "dist/cjs/index.js",
5
5
  "module": "dist/esm/index.js",
6
6
  "types": "dist/esm/index.d.ts",
@@ -8,6 +8,26 @@
8
8
  ".": {
9
9
  "import": "./dist/esm/index.js",
10
10
  "require": "./dist/cjs/index.js"
11
+ },
12
+ "./kit": {
13
+ "import": "./dist/esm/kit/index.js",
14
+ "require": "./dist/cjs/kit/index.js"
15
+ },
16
+ "./util": {
17
+ "import": "./dist/esm/util/index.js",
18
+ "require": "./dist/cjs/util/index.js"
19
+ },
20
+ "./modules/": {
21
+ "import": "./dist/esm/modules/index.js",
22
+ "require": "./dist/cjs/modules/index.js"
23
+ },
24
+ "./document/": {
25
+ "import": "./dist/esm/document/index.js",
26
+ "require": "./dist/cjs/document/index.js"
27
+ },
28
+ "./model/": {
29
+ "import": "./dist/esm/model/index.js",
30
+ "require": "./dist/cjs/model/index.js"
11
31
  }
12
32
  },
13
33
  "scripts": {