Skip to content

Commit ac3751f

Browse files
committed
NodeJS implementation
1 parent 0e6ac0f commit ac3751f

File tree

3 files changed

+130
-0
lines changed

3 files changed

+130
-0
lines changed

.gitignore

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,84 @@ modules.order
5050
Module.symvers
5151
Mkfile.old
5252
dkms.conf
53+
54+
# Logs
55+
logs
56+
*.log
57+
npm-debug.log*
58+
yarn-debug.log*
59+
yarn-error.log*
60+
61+
# Runtime data
62+
pids
63+
*.pid
64+
*.seed
65+
*.pid.lock
66+
67+
# Directory for instrumented libs generated by jscoverage/JSCover
68+
lib-cov
69+
70+
# Coverage directory used by tools like istanbul
71+
coverage
72+
73+
# nyc test coverage
74+
.nyc_output
75+
76+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
77+
.grunt
78+
79+
# Bower dependency directory (https://bower.io/)
80+
bower_components
81+
82+
# node-waf configuration
83+
.lock-wscript
84+
85+
# Compiled binary addons (https://nodejs.org/api/addons.html)
86+
build/Release
87+
88+
# Dependency directories
89+
node_modules/
90+
jspm_packages/
91+
92+
# TypeScript v1 declaration files
93+
typings/
94+
95+
# Optional npm cache directory
96+
.npm
97+
98+
# Optional eslint cache
99+
.eslintcache
100+
101+
# Optional REPL history
102+
.node_repl_history
103+
104+
# Output of 'npm pack'
105+
*.tgz
106+
107+
# Yarn Integrity file
108+
.yarn-integrity
109+
110+
# dotenv environment variables file
111+
.env
112+
.env.test
113+
114+
# parcel-bundler cache (https://parceljs.org/)
115+
.cache
116+
117+
# next.js build output
118+
.next
119+
120+
# nuxt.js build output
121+
.nuxt
122+
123+
# vuepress build output
124+
.vuepress/dist
125+
126+
# Serverless directories
127+
.serverless/
128+
129+
# FuseBox cache
130+
.fusebox/
131+
132+
# DynamoDB Local files
133+
.dynamodb/

node/package.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"name": "zlibserver",
3+
"author": "Eduard Lebedyuk",
4+
"version": "0.0.1",
5+
"description": "Sample zlib compress server",
6+
"repository": {
7+
"type": "git",
8+
"url": "https://github.com/intersystems-ru/zlibisc.git"
9+
},
10+
"keywords": [
11+
"intersystems",
12+
"cache",
13+
"intersystems iris"
14+
],
15+
"dependencies": {
16+
"express": "*"
17+
},
18+
"license": "MIT"
19+
}

node/zlibserver.js

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
//zlibserver.js
2+
const express = require('express');
3+
const zlib = require('zlib');
4+
5+
var app = express();
6+
7+
app.get('/zlibapi/:text', function(req, res) {
8+
res.type('application/json');
9+
10+
var text=req.params.text;
11+
12+
try {
13+
zlib.deflate(text, (err, buffer) => {
14+
if (!err) {
15+
res.status(200).send(buffer.toString('binary'));
16+
} else {
17+
res.status(500).json( { "error" : err.message});
18+
// handle error
19+
}
20+
});
21+
}
22+
catch(err) {
23+
res.status(500).json({ "error" : err.message});
24+
return;
25+
}
26+
27+
});
28+
app.listen(3000, function(){
29+
console.log("zlibserver is ready captain.");
30+
});

0 commit comments

Comments
 (0)