Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
gdd-sigma-poc
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
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
Guillaume WANG
gdd-sigma-poc
Commits
ffde0a39
Commit
ffde0a39
authored
7 years ago
by
Wilson JALLET
Browse files
Options
Downloads
Patches
Plain Diff
Implémentation GraphQL
Avec iGraphQL pour interagir avec le schéma GraphQL
parent
5d229fa7
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
.gitlab-ci.yml
+2
-3
2 additions, 3 deletions
.gitlab-ci.yml
src/index.js
+0
-3
0 additions, 3 deletions
src/index.js
src/server.js
+31
-0
31 additions, 0 deletions
src/server.js
src/views/home.pug
+1
-1
1 addition, 1 deletion
src/views/home.pug
with
34 additions
and
7 deletions
.gitlab-ci.yml
+
2
−
3
View file @
ffde0a39
...
...
@@ -49,7 +49,7 @@ test:lint:
test:async
:
stage
:
test
script
:
-
npm start
-
npm start
&
-
sleep
5
-
curl http://localhost:3000
-
pkill node
...
...
@@ -60,8 +60,7 @@ test:async:
deploy_staging
:
stage
:
deploy
script
:
-
npm start &
-
sleep
30
-
npm start & sleep
5
-
exit
0
environment
:
name
:
staging
...
...
This diff is collapsed.
Click to expand it.
src/index.js
+
0
−
3
View file @
ffde0a39
import
server
from
'
./server
'
;
import
router
from
'
./admin_view/admin_view
'
;
import
colors
from
'
colors
'
;
import
{
graphqlExpress
,
graphiqlExpress
}
from
'
graphql-server-express
'
;
import
makeExecutableSchema
from
'
graphql-tools
'
;
import
knex
from
'
../db/knex_router
'
;
import
path
from
'
path
'
;
/**
...
...
This diff is collapsed.
Click to expand it.
src/server.js
+
31
−
0
View file @
ffde0a39
...
...
@@ -2,8 +2,11 @@ import express from 'express';
import
bodyParser
from
'
body-parser
'
;
import
favicon
from
'
serve-favicon
'
;
import
morgan
from
'
morgan
'
;
import
knex
from
'
../db/knex_router
'
;
import
path
from
'
path
'
;
import
ldap_auth
from
'
./ldap_auth/ldap_auth
'
;
import
{
graphqlExpress
,
graphiqlExpress
}
from
'
graphql-server-express
'
;
import
{
makeExecutableSchema
}
from
'
graphql-tools
'
;
/**
* @file server.js
...
...
@@ -34,4 +37,32 @@ server.use(morgan('dev'));
// setting up ldap authentication
ldap_auth
(
server
);
const
typeDefs
=
`
type Query {
groups: [Group]
}
type Group {
name: String
id: Int
school: String
}
`
;
const
resolvers
=
{
Query
:
{
groups
:
()
=>
knex
.
select
().
from
(
'
groups
'
)
}
};
const
schema
=
makeExecutableSchema
({
typeDefs
,
resolvers
});
server
.
use
(
'
/graphql
'
,
bodyParser
.
json
(),
graphqlExpress
({
schema
}));
server
.
use
(
'
/graphiql
'
,
graphiqlExpress
({
endpointURL
:
'
/graphql
'
}));
export
default
server
;
This diff is collapsed.
Click to expand it.
src/views/home.pug
+
1
−
1
View file @
ffde0a39
...
...
@@ -12,4 +12,4 @@ block content
input.form-control(type="search", name="columns")
button.form-control(type="submit") Search
|
a(href="/graphql") Check GraphQL
\ No newline at end of file
a(href="/graphiql") Check GraphQL
\ No newline at end of file
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