@nattyjs/express 0.0.1-beta.10 → 0.0.1-beta.11

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.
package/dist/index.cjs CHANGED
@@ -81,18 +81,15 @@ const app = express__default();
81
81
  const ExpressModule = {
82
82
  init(config) {
83
83
  app.use(compression__default());
84
- app.use(cors__default({
85
- "origin": ["http://localhost:5173", "http://localhost:5174"],
86
- "methods": "GET,HEAD,PUT,PATCH,POST,DELETE",
87
- "preflightContinue": false,
88
- "optionsSuccessStatus": 204,
89
- "credentials": true
90
- }));
84
+ if (config.cors)
85
+ app.use(cors__default(config.cors));
91
86
  app.use(express__default.json());
92
87
  app.all("*", requestHandler(config));
93
88
  if (config.autoGeneratePort == true || config.autoGeneratePort == void 0)
94
- app.listen(3e3, () => {
95
- console.log("Server is running on port 3000 ");
89
+ common.getPort().then((port) => {
90
+ app.listen(port, () => {
91
+ console.log(`[NATTYJS]:Server is running on port ${port}`);
92
+ });
96
93
  });
97
94
  return app;
98
95
  }
package/dist/index.mjs CHANGED
@@ -2,7 +2,7 @@ import express from 'express';
2
2
  import cors from 'cors';
3
3
  import compression from 'compression';
4
4
  import { HttpHandler, HttpContext } from '@nattyjs/core';
5
- import { GET, FrameworkType } from '@nattyjs/common';
5
+ import { GET, FrameworkType, getPort } from '@nattyjs/common';
6
6
 
7
7
  async function getRequestBodyInfo(request) {
8
8
  const contentType = request.headers["content-type"];
@@ -73,18 +73,15 @@ const app = express();
73
73
  const ExpressModule = {
74
74
  init(config) {
75
75
  app.use(compression());
76
- app.use(cors({
77
- "origin": ["http://localhost:5173", "http://localhost:5174"],
78
- "methods": "GET,HEAD,PUT,PATCH,POST,DELETE",
79
- "preflightContinue": false,
80
- "optionsSuccessStatus": 204,
81
- "credentials": true
82
- }));
76
+ if (config.cors)
77
+ app.use(cors(config.cors));
83
78
  app.use(express.json());
84
79
  app.all("*", requestHandler(config));
85
80
  if (config.autoGeneratePort == true || config.autoGeneratePort == void 0)
86
- app.listen(3e3, () => {
87
- console.log("Server is running on port 3000 ");
81
+ getPort().then((port) => {
82
+ app.listen(port, () => {
83
+ console.log(`[NATTYJS]:Server is running on port ${port}`);
84
+ });
88
85
  });
89
86
  return app;
90
87
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nattyjs/express",
3
- "version": "0.0.1-beta.10",
3
+ "version": "0.0.1-beta.11",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "author": "ajayojha <ojhaajay@outlook.com>",
@@ -18,9 +18,9 @@
18
18
  "express": "4.18.2",
19
19
  "cors": "2.8.5",
20
20
  "compression": "1.7.4",
21
- "@nattyjs/core": "0.0.1-beta.10",
22
- "@nattyjs/common": "0.0.1-beta.10",
23
- "@nattyjs/types": "0.0.1-beta.10"
21
+ "@nattyjs/core": "0.0.1-beta.11",
22
+ "@nattyjs/common": "0.0.1-beta.11",
23
+ "@nattyjs/types": "0.0.1-beta.11"
24
24
  },
25
25
  "devDependencies": {
26
26
  "@types/node": "20.3.1",