Toggle navigation
Toggle navigation
This project
Loading...
Sign in
2020-1-capstone-design1
/
Triz_Project1
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
1
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
MinsoftK
2020-04-09 18:18:20 +0900
Browse Files
Options
Browse Files
Download
Plain Diff
Commit
373e9dd3d0f7f1f66f878f83c017ead481320e31
373e9dd3
2 parents
25daac6b
ad391c08
Merge branch 'master' of
https://bitbucket.org/vel1024/capstone2
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
15 deletions
back/package.json
back/src/schema.js
back/src/server.js
back/package.json
View file @
373e9dd
...
...
@@ -14,12 +14,15 @@
"homepage"
:
"https://bitbucket.org/vel1024/capstone2#readme"
,
"dependencies"
:
{
"dotenv"
:
"^8.2.0"
,
"graphql-yoga"
:
"^1.18.3"
"graphql-tools"
:
"^4.0.7"
,
"graphql-yoga"
:
"^1.18.3"
,
"merge-graphql-schemas"
:
"^1.7.7"
},
"devDependencies"
:
{
"@babel/core"
:
"^7.9.0"
,
"@babel/node"
:
"^7.8.7"
,
"@babel/preset-env"
:
"^7.9.0"
,
"morgan"
:
"^1.10.0"
,
"nodemon"
:
"^2.0.2"
}
}
...
...
back/src/schema.js
0 → 100644
View file @
373e9dd
import
path
from
"path"
;
import
{
makeExecutableSchema
}
from
"graphql-tools"
;
import
{
fileLoader
,
mergeResolvers
,
mergeTypes
}
from
"merge-graphql-schemas"
;
const
allTypes
=
fileLoader
(
path
.
join
(
__dirname
,
"api/**/*.graphql"
));
const
allResolvers
=
fileLoader
(
path
.
join
(
__dirname
,
"api/**/*.js"
));
const
schema
=
makeExecutableSchema
({
typeDefs
:
mergeTypes
(
allTypes
),
resolvers
:
mergeResolvers
(
allResolvers
),
});
export
default
schema
;
back/src/server.js
View file @
373e9dd
import
{
GraphQLServer
}
from
"graphql-yoga"
;
import
dotenv
from
"dotenv"
;
dotenv
.
config
();
import
{
GraphQLServer
}
from
"graphql-yoga"
;
import
morgan
from
"morgan"
;
import
schema
from
"./schema"
;
const
PORT
=
process
.
env
.
PORT
||
4000
;
const
typeDefs
=
`
type Query {
hello(name: String): String
}
`
;
const
PORT
=
process
.
env
.
PORT
;
const
resolvers
=
{
Query
:
{
hello
:
()
=>
"hello"
,
},
};
const
server
=
new
GraphQLServer
({
schema
});
const
server
=
new
GraphQLServer
({
typeDefs
,
resolvers
}
);
server
.
express
.
use
(
morgan
(
"dev"
)
);
server
.
start
(()
=>
console
.
log
(
`server is running : http://localhost:
${
PORT
}
`
));
...
...
Please
register
or
login
to post a comment