@steedos/router 2.3.2-beta.3
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/LICENSE.txt +22 -0
- package/lib/index.d.ts +13 -0
- package/lib/index.js +57 -0
- package/lib/index.js.map +1 -0
- package/package.json +22 -0
- package/src/index.ts +69 -0
- package/tsconfig.json +26 -0
package/LICENSE.txt
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
Steedos Licensing
|
|
2
|
+
|
|
3
|
+
SOFTWARE LICENSING
|
|
4
|
+
|
|
5
|
+
To determine under which license you may use a file from the Steedos source code,
|
|
6
|
+
please resort to the header of that file.
|
|
7
|
+
|
|
8
|
+
If the file has no header, the following rules apply
|
|
9
|
+
1. enterprise features are licensed under Steedos Enterprise Terms, see License.enterprise.txt
|
|
10
|
+
2. source code that is neither (1) is licensed under MIT, see https://opensource.org/licenses/MIT
|
|
11
|
+
|
|
12
|
+
On request, licenses under different terms are available.
|
|
13
|
+
|
|
14
|
+
Source code of enterprise features are files that
|
|
15
|
+
* are in folders named "ee" or start with "ee_", or in subfolders of such folders.
|
|
16
|
+
* contain the strings "ee_" in its filename name.
|
|
17
|
+
The files can be found by running the command `find . -iname ee -or -iname "*_ee*" -or -iname "*ee_*"`
|
|
18
|
+
|
|
19
|
+
STEEDOS TRADEMARK GUIDELINES
|
|
20
|
+
|
|
21
|
+
Your use of the mark Steedos is subject to Steedos, Inc's prior written approval. For trademark approval or any questions
|
|
22
|
+
you have about using these trademarks, please email zhuangjianguo@steedos.com
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
declare class ExpressAppStatic {
|
|
2
|
+
app: any;
|
|
3
|
+
beforeRouter: any;
|
|
4
|
+
router: any;
|
|
5
|
+
constructor();
|
|
6
|
+
staticRouter: () => any;
|
|
7
|
+
staticApp: () => any;
|
|
8
|
+
staticBeforeRouter: () => any;
|
|
9
|
+
}
|
|
10
|
+
export declare const expressApp: ExpressAppStatic;
|
|
11
|
+
export declare const staticRouter: () => any;
|
|
12
|
+
export declare const staticBeforeRouter: () => any;
|
|
13
|
+
export {};
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
exports.__esModule = true;
|
|
3
|
+
exports.staticBeforeRouter = exports.staticRouter = exports.expressApp = void 0;
|
|
4
|
+
var express = require("express");
|
|
5
|
+
var cors = require('cors');
|
|
6
|
+
var compression = require('compression');
|
|
7
|
+
var session = require('express-session');
|
|
8
|
+
var ExpressAppStatic = (function () {
|
|
9
|
+
function ExpressAppStatic() {
|
|
10
|
+
var _this = this;
|
|
11
|
+
this.app = null;
|
|
12
|
+
this.beforeRouter = null;
|
|
13
|
+
this.router = null;
|
|
14
|
+
this.staticRouter = function () {
|
|
15
|
+
return _this.router;
|
|
16
|
+
};
|
|
17
|
+
this.staticApp = function () {
|
|
18
|
+
return _this.app;
|
|
19
|
+
};
|
|
20
|
+
this.staticBeforeRouter = function () {
|
|
21
|
+
return _this.beforeRouter;
|
|
22
|
+
};
|
|
23
|
+
this.beforeRouter = express.Router();
|
|
24
|
+
this.router = express.Router();
|
|
25
|
+
var app = express();
|
|
26
|
+
app.use(cors({ origin: true, credentials: true }));
|
|
27
|
+
app.use(compression());
|
|
28
|
+
app.use(session({
|
|
29
|
+
secret: process.env.STEEDOS_SESSION_SECRET || 'steedos',
|
|
30
|
+
resave: false,
|
|
31
|
+
saveUninitialized: true,
|
|
32
|
+
cookie: { secure: false, maxAge: 800000 },
|
|
33
|
+
name: 'ivan'
|
|
34
|
+
}));
|
|
35
|
+
if (process.env.STEEDOS_API_PORT) {
|
|
36
|
+
app.listen(process.env.STEEDOS_API_PORT, function (err) {
|
|
37
|
+
if (err)
|
|
38
|
+
return console.log(err);
|
|
39
|
+
app.use(_this.staticBeforeRouter());
|
|
40
|
+
app.use(_this.staticRouter());
|
|
41
|
+
return console.info("Steedos Experience Server listening on ".concat(process.env.STEEDOS_API_URL));
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
this.app = app;
|
|
45
|
+
}
|
|
46
|
+
return ExpressAppStatic;
|
|
47
|
+
}());
|
|
48
|
+
exports.expressApp = new ExpressAppStatic();
|
|
49
|
+
var staticRouter = function () {
|
|
50
|
+
return exports.expressApp.staticRouter();
|
|
51
|
+
};
|
|
52
|
+
exports.staticRouter = staticRouter;
|
|
53
|
+
var staticBeforeRouter = function () {
|
|
54
|
+
return exports.expressApp.staticBeforeRouter();
|
|
55
|
+
};
|
|
56
|
+
exports.staticBeforeRouter = staticBeforeRouter;
|
|
57
|
+
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAOA,IAAM,OAAO,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;AACnC,IAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;AAC7B,IAAM,WAAW,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;AAC3C,IAAM,OAAO,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAA;AAE1C;IAII;QAAA,iBAwBC;QA3BD,QAAG,GAAG,IAAI,CAAC;QACX,iBAAY,GAAG,IAAI,CAAC;QACpB,WAAM,GAAG,IAAI,CAAC;QA2BP,iBAAY,GAAG;YAClB,OAAO,KAAI,CAAC,MAAM,CAAC;QACvB,CAAC,CAAA;QAEM,cAAS,GAAG;YACf,OAAO,KAAI,CAAC,GAAG,CAAC;QACpB,CAAC,CAAA;QAEM,uBAAkB,GAAG;YACxB,OAAO,KAAI,CAAC,YAAY,CAAC;QAC7B,CAAC,CAAA;QAnCG,IAAI,CAAC,YAAY,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;QACrC,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;QAE/B,IAAM,GAAG,GAAG,OAA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kBAAkB,EAAE,CAAC;AAC3C,CAAC,CAAA;AAFY,QAAA,kBAAkB,sBAE9B"}
|
package/package.json
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@steedos/router",
|
|
3
|
+
"private": false,
|
|
4
|
+
"version": "2.3.2-beta.3",
|
|
5
|
+
"description": "",
|
|
6
|
+
"main": "lib/index.js",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"build": "rm -rf ./lib && tsc",
|
|
9
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
10
|
+
},
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"compression": "1.7.4",
|
|
13
|
+
"cors": "2.8.5"
|
|
14
|
+
},
|
|
15
|
+
"author": "",
|
|
16
|
+
"license": "ISC",
|
|
17
|
+
"types": "lib/index.d.ts",
|
|
18
|
+
"publishConfig": {
|
|
19
|
+
"access": "public"
|
|
20
|
+
},
|
|
21
|
+
"gitHead": "1f337e8da176f1c75a8596b29ec7889eca996dc1"
|
|
22
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @Author: baozhoutao@steedos.com
|
|
3
|
+
* @Date: 2022-11-15 14:48:43
|
|
4
|
+
* @LastEditors: baozhoutao@steedos.com
|
|
5
|
+
* @LastEditTime: 2022-11-17 11:15:40
|
|
6
|
+
* @Description:
|
|
7
|
+
*/
|
|
8
|
+
const express = require("express");
|
|
9
|
+
const cors = require('cors');
|
|
10
|
+
const compression = require('compression');
|
|
11
|
+
const session = require('express-session')
|
|
12
|
+
|
|
13
|
+
class ExpressAppStatic{
|
|
14
|
+
app = null;
|
|
15
|
+
beforeRouter = null;
|
|
16
|
+
router = null;
|
|
17
|
+
constructor(){
|
|
18
|
+
this.beforeRouter = express.Router();
|
|
19
|
+
this.router = express.Router();
|
|
20
|
+
// 读取环境变量、配置文件, 启动端口, 控制中间件
|
|
21
|
+
const app = express();
|
|
22
|
+
app.use(cors({origin: true, credentials: true}))
|
|
23
|
+
app.use(compression());
|
|
24
|
+
app.use(session({
|
|
25
|
+
secret: process.env.STEEDOS_SESSION_SECRET || 'steedos',
|
|
26
|
+
resave: false,
|
|
27
|
+
saveUninitialized: true,
|
|
28
|
+
cookie: { secure: false, maxAge: 800000 },
|
|
29
|
+
name: 'ivan'
|
|
30
|
+
}))
|
|
31
|
+
if(process.env.STEEDOS_API_PORT){
|
|
32
|
+
app.listen(process.env.STEEDOS_API_PORT, err => {
|
|
33
|
+
if (err)
|
|
34
|
+
return console.log(err)
|
|
35
|
+
app.use(this.staticBeforeRouter())
|
|
36
|
+
app.use(this.staticRouter())
|
|
37
|
+
return console.info(`Steedos Experience Server listening on ${process.env.STEEDOS_API_URL}`);
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
this.app = app;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
public staticRouter = ()=>{
|
|
44
|
+
return this.router;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
public staticApp = ()=>{
|
|
48
|
+
return this.app;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
public staticBeforeRouter = ()=>{
|
|
52
|
+
return this.beforeRouter;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export const expressApp = new ExpressAppStatic();
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
export const staticRouter = ()=>{
|
|
60
|
+
return expressApp.staticRouter();
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export const staticBeforeRouter = ()=>{
|
|
64
|
+
return expressApp.staticBeforeRouter();
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// setInterval(()=>{
|
|
68
|
+
// console.log(`expressApp.staticRouter()====>`, expressApp.staticRouter())
|
|
69
|
+
// }, 1000)
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"outDir": "./lib",
|
|
4
|
+
"strict": false,
|
|
5
|
+
"noUnusedLocals": true,
|
|
6
|
+
"emitDecoratorMetadata": true,
|
|
7
|
+
"experimentalDecorators": true,
|
|
8
|
+
"sourceMap": true,
|
|
9
|
+
"resolveJsonModule": true,
|
|
10
|
+
"skipLibCheck": true,
|
|
11
|
+
"declaration": true,
|
|
12
|
+
"lib": [
|
|
13
|
+
"es5",
|
|
14
|
+
"es6",
|
|
15
|
+
"dom",
|
|
16
|
+
"es2015",
|
|
17
|
+
"es2016",
|
|
18
|
+
"es2017",
|
|
19
|
+
"esnext"
|
|
20
|
+
],
|
|
21
|
+
"removeComments": true
|
|
22
|
+
},
|
|
23
|
+
"include": [
|
|
24
|
+
"./src/**/*"
|
|
25
|
+
]
|
|
26
|
+
}
|