Skip to content
This repository was archived by the owner on Nov 8, 2022. It is now read-only.

Commit 85f512e

Browse files
committed
play with Graphql
1 parent a29d792 commit 85f512e

File tree

6 files changed

+39
-14
lines changed

6 files changed

+39
-14
lines changed

.graphqlconfig

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22
"schemaPath": "schema.graphql",
33
"extensions": {
44
"endpoints": {
5+
"example": {
6+
"url": "http://localhost:4000/api/graphiql"
7+
},
8+
"book": {
9+
"url": "http://localhost:5000/graphiql"
10+
},
511
"test": {
612
"url": "https://api.graph.cool/simple/v1/swapi"
713
},

next.config.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,18 @@ module.exports = {
2929
loader: 'raw-loader',
3030
})
3131
*/
32+
/*
33+
config.module.rules.push(
34+
{
35+
test: /\.css$/,
36+
use: ['style-loader', 'css-loader'],
37+
},
38+
{
39+
test: /\.(svg|eot|ttf|woff|woff2)$/,
40+
use: 'url-loader',
41+
}
42+
)
43+
*/
3244

3345
if (ANALYZE) {
3446
config.plugins.push(

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
"analyze": "cross-env ANALYZE=1 next build",
2222
"api:play": "GRAPHQL_CONFIG_ENDPOINT_NAME=mastani graphql playground",
2323
"api:graph": "graphql voyager",
24+
"graph:mastani": "graphql get-schema -e mastani && head ./schema.graphql",
25+
"graph:example": "graphql get-schema -e example && graphql voyager",
2426
"coveralls": "cat ./coverage/lcov.info | coveralls"
2527
},
2628
"lint-staged": {

pages/_document.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,15 @@ export default class MyDocument extends Document {
1616
href="http://image.mzliaoba.com/lib/antd.css"
1717
rel="stylesheet"
1818
/>
19+
{/* <link */}
20+
{/* href="https://cdn.bootcss.com/graphiql/0.11.10/graphiql.min.css" */}
21+
{/* rel="stylesheet" */}
22+
{/* /> */}
23+
{/* <link */}
24+
{/* href="https://raw.githubusercontent.com/mydearxym/cdn/master/voyager.css" */}
25+
{/* rel="stylesheet" */}
26+
{/* /> */}
27+
1928
{styleTags}
2029
</Head>
2130
<body>

pages/api.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ export default class Index extends React.Component {
3636
this.store = initRootStore(props.isServer, props.langSetup)
3737
}
3838

39+
// <Playground endpoint="https://api.graph.cool/simple/v1/swapi" />
40+
3941
render() {
4042
return (
4143
<Provider store={this.store}>
@@ -45,7 +47,7 @@ export default class Index extends React.Component {
4547
<Doraemon />
4648
<ApiLayout>
4749
<Header />
48-
<div>hallo?</div>
50+
<div style={{ marginTop: '2vh' }}>api</div>
4951
</ApiLayout>
5052
</MultiLanguage>
5153
</ThemeWrapper>

schema.graphql

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,16 @@
1-
# source: http://localhost:4001/graphiql
2-
# timestamp: Fri Nov 24 2017 23:04:58 GMT+0800 (CST)
1+
# source: http://localhost:5000/graphiql
2+
# timestamp: Mon Dec 11 2017 11:46:04 GMT+0800 (CST)
33

44
schema {
55
query: RootQueryType
6-
mutation: RootMutationType
76
}
87

9-
type Link {
10-
description: String!
11-
id: ID!
12-
url: String!
13-
}
14-
15-
type RootMutationType {
16-
createLink(description: String!, url: String!): Link
8+
type MenuItem {
9+
description: String
10+
id: ID
11+
name: String
1712
}
1813

1914
type RootQueryType {
20-
# hehehef: Get all links
21-
allLinks: [Link!]!
15+
menuItems: [MenuItem]
2216
}

0 commit comments

Comments
 (0)