Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
N
node-bigstream
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
3
Merge Requests
3
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
bs
node-bigstream
Commits
7ad6dace
Commit
7ad6dace
authored
Feb 17, 2017
by
project
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
--no commit message
--no commit message
parent
0bd32ecc
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
79 additions
and
0 deletions
+79
-0
main.js
http-listener/main.js
+48
-0
index.js
http-listener/ws/index.js
+6
-0
service-main.js
http-listener/ws/service-main.js
+20
-0
serv-httplistener.js
serv-httplistener.js
+5
-0
No files found.
http-listener/main.js
View file @
7ad6dace
var
ctx
=
require
(
'../context'
);
var
express
=
require
(
'express'
);
var
app
=
express
();
var
bodyParser
=
require
(
'body-parser'
);
var
cfg
=
ctx
.
config
;
module
.
exports
.
create
=
function
(
cfg
)
{
var
hs
=
new
HTTPListener
(
cfg
);
return
hs
;
}
function
HTTPListener
(
cfg
)
{
this
.
config
=
cfg
;
}
HTTPListener
.
prototype
.
start
=
function
()
{
console
.
log
(
'Starting HTTP Listener ...
\
n'
);
this
.
http_start
();
}
HTTPListener
.
prototype
.
http_start
=
function
()
{
var
self
=
this
;
var
API_PORT
=
19180
;
app
.
use
(
bodyParser
.
json
({
limit
:
'5mb'
}));
app
.
use
(
bodyParser
.
urlencoded
({
extended
:
true
}));
app
.
use
(
require
(
'./ws'
));
app
.
listen
(
API_PORT
,
function
()
{
console
.
log
(
'WWW:HTTP START
\
t
\
t[OK]'
);
});
}
http-listener/ws/index.js
0 → 100644
View file @
7ad6dace
var
express
=
require
(
'express'
)
,
router
=
express
.
Router
()
router
.
use
(
'/'
,
require
(
'./service-main'
));
module
.
exports
=
router
;
http-listener/ws/service-main.js
0 → 100644
View file @
7ad6dace
var
ctx
=
require
(
'../../context'
);
var
express
=
require
(
'express'
);
var
router
=
express
.
Router
();
var
cfg
=
ctx
.
config
;
var
response
=
ctx
.
getLib
(
'lib/ws/response'
);
var
request
=
ctx
.
getLib
(
'lib/ws/request'
);
router
.
get
(
'/:akey'
,
function
(
req
,
res
)
{
var
reqHelper
=
request
.
create
(
req
);
var
respHelper
=
response
.
create
(
res
);
var
appkey
=
req
.
params
.
akey
;
respHelper
.
responseOK
({
'status'
:
'OK'
,
'appkey'
:
appkey
});
});
module
.
exports
=
router
;
serv-httplistener.js
0 → 100644
View file @
7ad6dace
var
ctx
=
require
(
'./context'
);
var
HTTPListener
=
ctx
.
getLib
(
'http-listener/main'
);
var
hs
=
HTTPListener
.
create
(
ctx
.
config
);
hs
.
start
();
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment