Skip to content

Commit

Permalink
Zowe Suite v1.24.0
Browse files Browse the repository at this point in the history
  • Loading branch information
zowe-robot authored Sep 2, 2021
2 parents d7328cc + 5a87ece commit 9746f50
Show file tree
Hide file tree
Showing 5 changed files with 5,670 additions and 7,943 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Sample angular app Changelog

All notable changes to the sample angular app will be documented in this file.

## 1.2.0

- Enhancement: Added a new dataservice 'callservice', which serves as an example for how to use the callService API. This service simply calls the 'hello' service and returns the result wrapped in a JSON message.
66 changes: 66 additions & 0 deletions nodeServer/ts/callService.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
import { Response, Request } from "express";
import { Router } from "express-serve-static-core";



/*
This program and the accompanying materials are
made available under the terms of the Eclipse Public License v2.0 which accompanies
this distribution, and is available at https://www.eclipse.org/legal/epl-v20.html
SPDX-License-Identifier: EPL-2.0
Copyright Contributors to the Zowe Project.
*/

const express = require('express');
const Promise = require('bluebird');

class CallService{
private context: any;
private router: Router;

constructor(context: any){
this.context = context;
let router = express.Router();
router.use(function noteRequest(req: Request,res: Response,next: any) {
context.logger.info('Saw request, method='+req.method);
next();
});
context.addBodyParseMiddleware(router);
router.post('/',function(req: Request,res: Response) {
(req as any).zluxData.plugin.callService('hello', '', {method:'POST', body: req.body, contentType:req.get('content-type')}).then((callRes)=> {
context.logger.info('callService Returned: statusCode=%s, statusMessage=%s, body length=%s',
callRes.statusCode,
callRes.statusMessage,
callRes.body.length);
res.status(200).json({'callService Returned':callRes.body});
});
});
this.router = router;
}

getRouter():Router{
return this.router;
}
}


exports.callServiceRouter = function(context): Router {
return new Promise(function(resolve, reject) {
let dataservice = new CallService(context);
resolve(dataservice.getRouter());
});
}


/*
This program and the accompanying materials are
made available under the terms of the Eclipse Public License v2.0 which accompanies
this distribution, and is available at https://www.eclipse.org/legal/epl-v20.html
SPDX-License-Identifier: EPL-2.0
Copyright Contributors to the Zowe Project.
*/

11 changes: 10 additions & 1 deletion pluginDefinition.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"identifier": "org.zowe.zlux.sample.angular",
"apiVersion": "1.0.0",
"pluginVersion": "1.1.0",
"pluginVersion": "1.2.1",
"pluginType": "application",
"webContent": {
"framework": "angular2",
Expand All @@ -28,6 +28,15 @@
"initializerLookupMethod": "external",
"version": "1.0.1"
},
{
"type": "router",
"name": "callservice",
"filename": "callService.js",
"routerFactory": "callServiceRouter",
"dependenciesIncluded": true,
"initializerLookupMethod": "external",
"version": "1.0.0"
},
{
"type": "router",
"name": "appServerStorage",
Expand Down
Loading

0 comments on commit 9746f50

Please sign in to comment.