Slide 1

Slide 1 text

,ōIFJ:BNBNPUP!LZNNU (SBQI2-φΠτ-5 (SBQI2-ͱ εΩʔϚϑΝʔετ։ൃ

Slide 2

Slide 2 text

(.0ϖύϘΧϥʔϛʔϦϐʔτCMPHLZNNUDPN ,ōhei Yamamoto /!LZNNU SVCZSBJMTZPLPIBNBSC

Slide 3

Slide 3 text

No content

Slide 4

Slide 4 text

͋ΒͨΊͯ঺հ͠·͢

Slide 5

Slide 5 text

εΩʔϚϑΝʔετ։ൃ wϑϩϯτΤϯυ '& ͱόοΫΤϯυ #& ؒͷ
 ΠϯλʔϑΣʔεఆٛΛ։ൃνʔϜ಺ͰઌʹܾΊΔ wͦͷ͋ͱ'&#&ʹ෼͔Εͯฒߦ։ൃ͢Δ

Slide 6

Slide 6 text

ฒߦ։ൃ w'&͸#&ͷ࣮૷͕ऴΘΔ·ͰϞοΫαʔόΛ࢖ͬͨΓ ͢Δ w3&45ͷ৔߹ w0QFO"1* 4XBHHFS ͰઌʹΠϯλϑΣʔεΛॻ͘ wपลπʔϧ 4XBHHFS$PEFHFOͳͲ Λ࢖ͬͯ
 ϞοΫαʔόΛ࡞Δ

Slide 7

Slide 7 text

ΠϯλʔϑΣʔεఆٛྫ 0QFO"1*ͷ৔߹ paths: /pets/{petId}: get: parameters: - name: petId in: path required: true schema: type: string responses: '200': content: application/json: schema: required: - id - name properties: id: type: integer format: int64 name: type: string (&5QFUTQFU@JE

Slide 8

Slide 8 text

ΧϥʔϛʔϦϐʔτ͸ εΩʔϚϑΝʔετ։ൃ͍ͯ͠·͢ '&7VFKT #&3BJMT

Slide 9

Slide 9 text

(SBQI2-ͰεΩʔϚϑΝʔετ։ൃ w3&45"1*ͰεΩʔϚΛܾΊ͔ͯΒ'&ͱ#&Ͱ
 ฒߦ։ൃΛਐΊΔͷ͸ศརͩͬͨ wҰ෦(SBQI2-Λಋೖͯ͠Έ͍ͯΔ w3BJMTͳͷͰHSBQIRMSVCZ w(SBQI2-Ͱ΋ಉ͡Α͏ʹͰ͖ͳ͍͔ʁ

Slide 10

Slide 10 text

(SBQI2-ʹ͓͚ΔεΩʔϚϑΝʔετͱ͸ wεΩʔϚ͚ͩઌʹܾΊΔ w#&͸SFTPMWFSΛ͋ͱͰ࣮૷͢Δ w'&͕࢖͏ϞοΫαʔό͸Ͳ͏͢Δʁ

Slide 11

Slide 11 text

"QPMMPͱHSBQIRMSVCZΛ
 ૊Έ߹ΘͤͯϞοΫαʔόΛ࡞ΕΔ

Slide 12

Slide 12 text

HSBQIRMSVCZ w3VCZͷγϯλοΫεͰ(SBQI2-εΩʔϚΛॻ͘ w(SBQI2-ͷεΩʔϚΛμϯϓͰ͖Δ

Slide 13

Slide 13 text

3VCZͰεΩʔϚΛॻ͘ class Types::QueryType < Types::BaseObject field :viewer, Types::UserType, null: true # resolverΛॻ͍ͯͳ͍ʂ end class Types::UserType < Types::BaseObject field :email, String, null: true field :popularPosts, [Types::PostType], null: true # resolverΛॻ͍ͯͳ͍ʂ end class Types::PostType < Types::BaseObject field :title, String, null: true end

Slide 14

Slide 14 text

HSBQIRMSVCZͰεΩʔϚΛμϯϓ FooBarSchema.to_definition # ҎԼͷจࣈྻΛऔಘ͢Δ type Query { viewer: User } type User { email: String popularPosts: [Post!] } type Post { title: String }

Slide 15

Slide 15 text

"QPMMP w"QPMMPͷ(SBQI2-5PPMTΛ࢖͏ w.PDLJOHͱ͍͏ػೳ͕͋Δ w(SBQI2-ͷεΩʔϚΛ৯ΘͤΔͱϞοΫαʔό͕
 ࡞ΕΔ

Slide 16

Slide 16 text

(SBQI2-5PPMTͰϞοΫαʔό // express, graphql-express, body-parserͳͲΛrequire import { addMockFunctionsToSchema, makeExecutableSchema } = require('graphql-tools'); const schema = makeExecutableSchema({ /* μϯϓͨ͠εΩʔϚจࣈྻ */ }); const mocks = require('./mocks') addMockFunctionsToSchema({ schema, mocks }); const app = express(); app.use('/graphql', bodyParser.json(), graphqlExpress({ schema })); app.listen(3000, () => { console.log('GraphQL mock server is running!!1'); });

Slide 17

Slide 17 text

(SBQI2-5PPMTͰϞοΫαʔό // mocks.js module.exports = { User: () => ({ email: '[email protected]', }), Post: () => ({ title: 'The Awesome Post', }), }; ϞοΫαʔό͕ฦ͢μϛʔσʔλΛॻ͚Δ ࢦఆ͠ͳ͚Ε͹εΧϥʔܕͷ஋͸"QPMMP͕ ద౰ʹฦ͢

Slide 18

Slide 18 text

ϞοΫαʔόͷ1045HSBQIRMΛୟ͍༷ͨࢠ

Slide 19

Slide 19 text

"QPMMPͱHSBQIRMSVCZΛ
 ૊Έ߹ΘͤͯϞοΫαʔόΛ࡞Εͨ

Slide 20

Slide 20 text

εΩʔϚϑΝʔετ։ൃͰ͖Δʂ
 ศརʂʂ

Slide 21

Slide 21 text

ৄ͘͠͸ͪ͜ΒͰ HJUIVCDPNLZNNUTDIFNBpSTUHSBQIRMFYBNQMF

Slide 22

Slide 22 text

ࢀߟ wIUUQCMPHLZNNUDPNFOUSZNPDLJOHHSBQIRMTFSWFSXJUI SBJMTBOEBQPMMP wIUUQTXXXBQPMMPHSBQIRMDPNEPDTHSBQIRMUPPMT NPDLJOHIUNM