Commit 9eefd53e authored by tiven wang's avatar tiven wang 🤞

added approuter

parent db33b024
## Build
* start `npm run watch:local`
* build `npm run ci-build`
* package `npm run ci-package`
```json
VCAP_SERVICES={"uaa": [{"binding_name": null, "credentials": {"clientid": "sb-my-cloud-sdk-demo!t15122", "clientsecret": "v53Bda2gKxFst1RO8LVsJ+La3CU=", "identityzone": "p2001285375trial", "identityzoneid": "0e78f0ec-997e-424c-9a71-f60d3b37b338", "sburl": "https://internal-xsuaa.authentication.eu10.hana.ondemand.com", "tenantid": "0e78f0ec-997e-424c-9a71-f60d3b37b338", "tenantmode": "dedicated", "uaadomain": "authentication.eu10.hana.ondemand.com", "url": "https://p2001285375trial.authentication.eu10.hana.ondemand.com", "verificationkey": "-----BEGIN PUBLIC KEY-----MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAwThn6OO9kj0bchkOGkqYBnV1dQ3zU/xtj7Kj7nDd8nyRMcEWCtVzrzjzhiisRhlrzlRIEY82wRAZNGKMnw7cvCwNixcfcDJnjzgr2pJ+5/yDZUc0IXXyIWPZD+XdL+0EogC3d4+fqyvg/BF/F0t2hKHWr/UTXE6zrGhBKaL0d8rKfYd6olGWigFd+3+24CKI14zWVxUBtC+P9Fhngc9DRzkXqhxOK/EKn0HzSgotf5duq6Tmk9DCNM4sLW4+ERc6xzrgbeEexakabvax/Az9WZ4qhwgw+fwIhKIC7WLwCEJaRsW4m7NKkv+eJR2LKYesuQ9SVAJ3EXV86RwdnH4uAv7lQHsKURPVAQBlranSqyQu0EXs2N9OlWTxe+FyNkIvyZvoLrZl/CdlYc8AKxRm5rn2/88nkrYQ0XZSrnICM5FRWgVF2hn5KfZGwtBN85/D4Yck6B3ocMfyX7e4URUm9lRPQFUJGTXaZnEIge0R159HUwhTN1HvyXrs6uT1ZZmW+c3p47dw1+LmUf/hIf8zd+uvHQjIeHEJqxjqfyA8yqAFKRHKVFrwnwdMHIsRap2EKBhHMfeVf0P2th5C9MggYoGCvdIaIUgMBX3TtCdvGrcWML7hnyS2zkrlA8SoKJnRcRF2KxWKs355FhpHpzqyZflO5l98+O8wOsFjGpL9d0ECAwEAAQ==-----END PUBLIC KEY-----", "xsappname": "my-cloud-sdk-demo!t15122"}, "instance_name": "my-xsuaa", "label": "xsuaa", "name": "my-xsuaa", "plan": "application", "provider": null, "syslog_drain_url": null, "tags": ["xsuaa"], "volume_mounts": []}]}
```
\ No newline at end of file
## Next steps
* Add grunt
* Add CI/CD on GitLab
* Add docker compose for test locally
\ No newline at end of file
This diff is collapsed.
......@@ -10,7 +10,7 @@
"watch:local": "nodemon -e ts -w ./src -x npm run serve-debug",
"serve-debug": "node -r ts-node/register --inspect src/index.ts",
"ci-build": "npx tsc",
"ci-package": "npm prune --production && cp -r node_modules dist package.json index.html deployment/",
"ci-package": "npm prune --production && cp -r dist package.json index.html deployment/",
"ci-backend-unit-test": "nyc --extension .ts --report-dir ./s4hana_pipeline/reports/coverage-reports/backend-unit/ --reporter cobertura mocha -r ts-node/register test/unit-tests/*.spec.ts --reporter mocha-junit-reporter --reporter-options mochaFile=./s4hana_pipeline/reports/backend-unit/results.xml",
"ci-integration-test": "nyc --extension .ts --report-dir ./s4hana_pipeline/reports/coverage-reports/backend-integration/ --reporter cobertura mocha -r ts-node/register test/integration-tests/*.spec.ts --reporter mocha-junit-reporter --reporter-options mochaFile=./s4hana_pipeline/reports/backend-integration/results.xml"
},
......@@ -30,14 +30,14 @@
"@sap/xsenv": "^2.0.0",
"@sap/xssec": "^2.1.17",
"@types/express": "^4.16.1",
"express": "^4.17.0",
"cfenv": "^1.2.2",
"passport": "^0.4.0",
"ts-node": "^8.1.0",
"typescript": "^3.4.5"
},
"devDependencies": {
"dotenv": "^8.0.0",
"express": "^4.17.0"
"dotenv": "^8.0.0"
},
"engines": {
"node": "10.15.x"
......
......@@ -24,11 +24,11 @@ class App {
this.app.use(express.urlencoded({ extended: false }));
// if(appEnv.port) {
// const services = xsenv.getServices({ uaa:'my-xsuaa' });
// passport.use(new JWTStrategy(services.uaa));
const services = xsenv.getServices({ uaa:'my-xsuaa' });
passport.use(new JWTStrategy(services.uaa));
// this.app.use(passport.initialize());
// this.app.use(passport.authenticate('JWT', { session: false }));
this.app.use(passport.initialize());
this.app.use(passport.authenticate('JWT', { session: false }));
// }
}
......
......@@ -4,6 +4,6 @@
</head>
<body>
<h1>JavaScript Tutorial</h1>
<a href="/business-partners/">myapp</a>
<a href="/myapp/">myapp</a>
</body>
</html>
\ No newline at end of file
{
"routes": [
{
"source": "^/business-partners/(.*)$",
"source": "^/myapp/(.*)$",
"target": "$1",
"destination": "myapp"
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment