Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
scanner
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
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
whats-this
scanner
Commits
9f4898db
Commit
9f4898db
authored
8 years ago
by
aurieh
Browse files
Options
Downloads
Patches
Plain Diff
Clean up, fix things
parent
c4cae1d0
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
.eslintrc.json
+3
-0
3 additions, 0 deletions
.eslintrc.json
index.js
+25
-4
25 additions, 4 deletions
index.js
with
28 additions
and
4 deletions
.eslintrc.json
+
3
−
0
View file @
9f4898db
{
{
"extends"
:
"standard"
,
"extends"
:
"standard"
,
"parserOptions"
:
{
"ecmaVersion"
:
6
},
"installedESLint"
:
true
,
"installedESLint"
:
true
,
"plugins"
:
[
"plugins"
:
[
"standard"
,
"standard"
,
...
...
This diff is collapsed.
Click to expand it.
index.js
+
25
−
4
View file @
9f4898db
...
@@ -15,13 +15,34 @@ for (let env of [
...
@@ -15,13 +15,34 @@ for (let env of [
// Create Koa app
// Create Koa app
const
app
=
koa
();
const
app
=
koa
();
const
route
=
require
(
"
koa-route
"
);
const
route
=
require
(
'
koa-route
'
);
// Error handler
app
.
use
(
function
*
(
next
)
{
try
{
yield
next
;
}
catch
(
err
)
{
if
(
err
.
isBoom
)
{
this
.
status
=
err
.
output
.
statusCode
||
500
;
this
.
body
=
err
.
output
.
payload
||
''
;
this
.
set
(
'
content-type
'
,
'
application/json; charset=utf-8
'
);
for
(
const
header
in
err
.
output
.
headers
||
{})
{
this
.
set
(
header
,
err
.
output
.
headers
[
header
]);
}
}
else
{
this
.
status
=
err
.
status
||
500
;
this
.
body
=
err
.
message
||
''
;
}
if
(
this
.
status
>
499
)
this
.
app
.
emit
(
'
error
'
,
err
,
this
);
}
});
/**
/**
* Parse request body.
* Parse request body.
*/
*/
app
.
use
(
next
=>
{
app
.
use
(
function
*
(
next
)
{
if
(
req
.
method
===
'
GET
'
||
req
.
method
===
'
DELETE
'
)
{
if
(
this
.
req
.
method
===
'
GET
'
||
this
.
req
.
method
===
'
DELETE
'
)
{
yield
next
;
yield
next
;
return
;
return
;
}
}
...
@@ -43,7 +64,7 @@ app.use(next => {
...
@@ -43,7 +64,7 @@ app.use(next => {
this
.
req
.
on
(
'
end
'
,
()
=>
{
this
.
req
.
on
(
'
end
'
,
()
=>
{
try
{
try
{
this
.
req
.
body
=
JSON
.
parse
(
rawData
);
this
.
req
.
body
=
JSON
.
parse
(
rawData
);
yield
next
;
next
()
;
return
;
return
;
}
catch
(
err
)
{
}
catch
(
err
)
{
this
.
body
=
{
this
.
body
=
{
...
...
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