orator-serviceserver-restify 1.0.0
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 +21 -0
- package/README.md +2 -0
- package/package.json +23 -0
- package/source/Orator-ServiceServer-Restify.js +55 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 Steven Velozo
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "orator-serviceserver-restify",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Restify Service Server for Orator",
|
|
5
|
+
"main": "source/Orator-ServiceServer-Restify.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
8
|
+
},
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "git+https://github.com/stevenvelozo/orator-serviceserver-restify.git"
|
|
12
|
+
},
|
|
13
|
+
"author": "steven velozo <steven@velozo.com>",
|
|
14
|
+
"license": "MIT",
|
|
15
|
+
"bugs": {
|
|
16
|
+
"url": "https://github.com/stevenvelozo/orator-serviceserver-restify/issues"
|
|
17
|
+
},
|
|
18
|
+
"homepage": "https://github.com/stevenvelozo/orator-serviceserver-restify#readme",
|
|
19
|
+
"dependencies": {
|
|
20
|
+
"orator-serviceserver": "^1.0.0",
|
|
21
|
+
"restify": "^11.1.0"
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
const libOratorServiceServerBase = require('orator-serviceserver');
|
|
2
|
+
const libRestify = require('restify');
|
|
3
|
+
|
|
4
|
+
class OratorServiceServerRestify extends libOratorServiceServerBase
|
|
5
|
+
{
|
|
6
|
+
constructor(pOrator)
|
|
7
|
+
{
|
|
8
|
+
super(pOrator);
|
|
9
|
+
|
|
10
|
+
this.server = restify.createServer();
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/*
|
|
14
|
+
* Service Lifecycle Functions
|
|
15
|
+
*************************************************************************/
|
|
16
|
+
listen(pPort, fCallback)
|
|
17
|
+
{
|
|
18
|
+
this.server.listen(pPort, (pError) =>
|
|
19
|
+
{
|
|
20
|
+
this.Active = true;
|
|
21
|
+
this.log.info(`RESTIFY server [${server.name}] listening on [${server.url}].`);
|
|
22
|
+
return fCallback(pError);
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
close(fCallback)
|
|
27
|
+
{
|
|
28
|
+
this.server.close((pError) =>
|
|
29
|
+
{
|
|
30
|
+
this.Active = false;
|
|
31
|
+
this.log.info(`RESTIFY server closed.`)
|
|
32
|
+
return fCallback(pError);
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
/*************************************************************************
|
|
36
|
+
* End of Service Lifecycle Functions
|
|
37
|
+
*/
|
|
38
|
+
|
|
39
|
+
get(pRoute, ...fRouteProcessingFunctions)
|
|
40
|
+
{
|
|
41
|
+
if (!super.get(pRoute, ...fRouteProcessingFunctions))
|
|
42
|
+
{
|
|
43
|
+
this.log.error(`RESTIFY provider failed to map GET route [${pRoute}]!`);
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return this.server.get('/hello/:name', ...fRouteProcessingFunctions);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/*************************************************************************
|
|
51
|
+
* End of Service Route Creation Functions
|
|
52
|
+
*/
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
module.exports = OratorServiceServerRestify;
|