mirror of
				https://github.com/KevinMidboe/linguist.git
				synced 2025-10-29 17:50:22 +00:00 
			
		
		
		
	Merge pull request #1303 from geekflyer/master
Add .xsjs and .xsjslib as JavaScript extension (SAP HANA XS)
This commit is contained in:
		| @@ -1095,6 +1095,8 @@ JavaScript: | ||||
|   - .pac | ||||
|   - .sjs | ||||
|   - .ssjs | ||||
|   - .xsjs | ||||
|   - .xsjslib | ||||
|   filenames: | ||||
|   - Jakefile | ||||
|   interpreters: | ||||
|   | ||||
							
								
								
									
										24
									
								
								samples/JavaScript/helloHanaEndpoint.xsjs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										24
									
								
								samples/JavaScript/helloHanaEndpoint.xsjs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,24 @@ | ||||
| /* | ||||
|  invoke endpoint by calling in a browser: | ||||
|  http://<hanaserveradress>:<xsengineport(usually 8000)>/<path>/<to>/<endpoint>/helloHanaMath.xsjslib?x=4&y=2 | ||||
|  e.g.: | ||||
|  http://192.168.178.20:8000/geekflyer/linguist/helloHanaEndpoint.xsjs?x=4&y=2 | ||||
|  */ | ||||
|  | ||||
| var hanaMath = $.import("./helloHanaMath.xsjslib"); | ||||
|  | ||||
| var x = parseFloat($.request.parameters.get("x")); | ||||
| var y = parseFloat($.request.parameters.get("y")); | ||||
|  | ||||
|  | ||||
| var result = hanaMath.multiply(x, y); | ||||
|  | ||||
| var output = { | ||||
|     title: "Hello HANA XS - do some simple math", | ||||
|     input: {x: x, y: y}, | ||||
|     result: result | ||||
| }; | ||||
|  | ||||
| $.response.contentType = "application/json"; | ||||
| $.response.statusCode = $.net.http.OK; | ||||
| $.response.setBody(JSON.stringify(output)); | ||||
							
								
								
									
										9
									
								
								samples/JavaScript/helloHanaMath.xsjslib
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								samples/JavaScript/helloHanaMath.xsjslib
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,9 @@ | ||||
| /* simple hana xs demo library, which can be used by multiple endpoints */ | ||||
|  | ||||
| function multiply(x, y) { | ||||
|     return x * y; | ||||
| } | ||||
|  | ||||
| function add(x, y) { | ||||
|     return x + y; | ||||
| } | ||||
		Reference in New Issue
	
	Block a user