Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
Open-Chess-back
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
Package Registry
Model registry
Operate
Environments
Terraform modules
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
Xadrez-LIvre
Open-Chess-back
Commits
e894a984
Commit
e894a984
authored
2 years ago
by
Leon A. Okida Gonçalves
Browse files
Options
Downloads
Patches
Plain Diff
Create DBHandler
parent
ccffd21b
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
index.js
+1
-0
1 addition, 0 deletions
index.js
package.json
+1
-0
1 addition, 0 deletions
package.json
src/ErrorHandler.ts
+6
-2
6 additions, 2 deletions
src/ErrorHandler.ts
with
8 additions
and
2 deletions
index.js
+
1
−
0
View file @
e894a984
...
@@ -13,4 +13,5 @@ const resolvers = {
...
@@ -13,4 +13,5 @@ const resolvers = {
};
};
const
server
=
new
ApolloServer
({
typeDefs
,
resolvers
});
const
server
=
new
ApolloServer
({
typeDefs
,
resolvers
});
server
.
listen
().
then
(({
url
})
=>
console
.
log
(
`Server started at
${
url
}
`
));
server
.
listen
().
then
(({
url
})
=>
console
.
log
(
`Server started at
${
url
}
`
));
\ No newline at end of file
This diff is collapsed.
Click to expand it.
package.json
+
1
−
0
View file @
e894a984
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
"version"
:
"1.0.0"
,
"version"
:
"1.0.0"
,
"description"
:
""
,
"description"
:
""
,
"main"
:
"index.js"
,
"main"
:
"index.js"
,
"type"
:
"module"
,
"scripts"
:
{
"scripts"
:
{
"test"
:
"echo
\"
Error: no test specified
\"
&& exit 1"
,
"test"
:
"echo
\"
Error: no test specified
\"
&& exit 1"
,
"start"
:
"node index"
"start"
:
"node index"
...
...
This diff is collapsed.
Click to expand it.
src/ErrorHandler.ts
+
6
−
2
View file @
e894a984
...
@@ -4,13 +4,17 @@ export class ErrorHandler {
...
@@ -4,13 +4,17 @@ export class ErrorHandler {
public
static
userHandler
(
input
:
any
)
{
public
static
userHandler
(
input
:
any
)
{
if
(
typeof
input
.
name
!==
"
string
"
)
if
(
(
typeof
input
.
name
!==
"
string
"
)
||
(
!
input
.
name
.
length
))
throw
new
Error
(
"
Invalid user name
"
);
throw
new
Error
(
"
Invalid user name
"
);
if
(
typeof
input
.
email
!==
"
string
"
)
if
(
(
typeof
input
.
email
!==
"
string
"
)
||
(
!
input
.
email
.
length
))
throw
new
Error
(
"
Invalid user email
"
);
throw
new
Error
(
"
Invalid user email
"
);
if
((
typeof
input
.
id
!==
"
number
"
)
||
(
isNaN
(
input
.
id
)))
throw
new
Error
(
"
Invalid id
"
);
const
newUser
:
UserInterface
=
{
const
newUser
:
UserInterface
=
{
userId
:
input
.
id
,
userName
:
input
.
name
,
userName
:
input
.
name
,
userEmail
:
input
.
email
userEmail
:
input
.
email
}
}
...
...
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