Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
simcaq-node
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
simcaq
simcaq-node
Commits
a36a5dde
There was a problem fetching the pipeline summary.
Commit
a36a5dde
authored
7 years ago
by
Vytor Calixto
Browse files
Options
Downloads
Patches
Plain Diff
Trying to make a query to the database
parent
639d964a
No related branches found
No related tags found
1 merge request
!116
Release v1.0.0
Pipeline
#
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/libs/routes/api.js
+0
-20
0 additions, 20 deletions
src/libs/routes/api.js
src/libs/routes/region.js
+34
-0
34 additions, 0 deletions
src/libs/routes/region.js
with
34 additions
and
20 deletions
src/libs/routes/api.js
+
0
−
20
View file @
a36a5dde
...
...
@@ -6,8 +6,6 @@ const libs = `${process.cwd()}/libs`;
const
config
=
require
(
`
${
libs
}
/config`
);
const
log
=
require
(
`
${
libs
}
/log`
)(
module
);
const
classes
=
require
(
'
./class
'
);
const
cache
=
require
(
'
apicache
'
).
options
({
debug
:
config
.
debug
,
statusCodes
:
{
include
:
[
200
]}
}).
middleware
;
...
...
@@ -32,24 +30,6 @@ const classroom = require('./classroom');
const
teacher
=
require
(
'
./teacher
'
);
const
workerpool
=
require
(
'
workerpool
'
);
const
pool
=
workerpool
.
pool
();
function
add
(
a
,
b
)
{
return
a
+
b
;
}
api
.
get
(
'
/add
'
,
(
req
,
res
)
=>
{
pool
.
exec
(
add
,
[
3
,
4
])
.
then
((
result
)
=>
{
log
.
debug
(
'
result
'
);
log
.
debug
(
result
);
pool
.
clear
();
});
res
.
json
({
msg
:
'
Está sendo feito
'
});
});
api
.
get
(
'
/
'
,
(
req
,
res
)
=>
{
res
.
json
({
msg
:
'
SimCAQ API is running
'
});
});
...
...
This diff is collapsed.
Click to expand it.
src/libs/routes/region.js
+
34
−
0
View file @
a36a5dde
...
...
@@ -4,6 +4,8 @@ const regionApp = express.Router();
const
libs
=
`
${
process
.
cwd
()}
/libs`
;
const
log
=
require
(
`
${
libs
}
/log`
)(
module
);
const
squel
=
require
(
'
squel
'
);
const
query
=
require
(
`
${
libs
}
/middlewares/query`
);
...
...
@@ -51,4 +53,36 @@ regionApp.get('/', rqf.parse(), rqf.build(), (req, res, next) => {
next
();
},
query
,
response
(
'
region
'
));
const
workerpool
=
require
(
'
workerpool
'
);
const
pool
=
workerpool
.
pool
();
const
execQuery
=
require
(
`
${
libs
}
/db/query_exec`
);
function
add
(
a
,
b
)
{
return
a
+
b
;
}
function
download
(
query
)
{
console
.
log
(
query
);
// return add(3,4);
// return execQuery(query.text, query.values);
return
new
Promise
(
function
(
resolve
,
reject
)
{
setTimeout
(
function
()
{
resolve
(
3
+
4
);
},
1000
);
});
}
regionApp
.
get
(
'
/download
'
,
(
req
,
res
)
=>
{
req
.
sql
.
from
(
'
regiao
'
).
field
(
'
*
'
);
let
params
=
req
.
sql
.
toParam
();
pool
.
exec
(
download
,
[
params
])
.
then
((
result
)
=>
{
console
.
log
(
'
PEPO
'
);
log
.
debug
(
'
RESULT
'
);
log
.
debug
(
result
);
pool
.
clear
();
});
res
.
json
({
msg
:
'
Wait for it...
'
});
});
module
.
exports
=
regionApp
;
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment