Apollo-link-rest: ๋” ์ด์ƒ ์‚ฌ์šฉ๋˜์ง€ ์•Š์Œ : '@rest (path :'์— ':'์ฝœ๋ก ์ด ํฌํ•จ๋ฉ๋‹ˆ๋‹ค.์ด ํ˜•์‹์€ ํ–ฅํ›„ ๋ฒ„์ „์—์„œ ์ œ๊ฑฐ๋ฉ๋‹ˆ๋‹ค.

์— ๋งŒ๋“  2018๋…„ 08์›” 31์ผ  ยท  2์ฝ”๋ฉ˜ํŠธ  ยท  ์ถœ์ฒ˜: apollographql/apollo-link-rest

const restLink = new RestLink({
  uri: 'https://swapi.co/api/',
});

const client = new ApolloClient({
  link: restLink,
  cache: new InMemoryCache(),
});
const Query = gql`
  query luke($id: String!) {
    person(id: $id)
     @rest(type: "Person", path: "people/:id") {
      name
    }
  }
`;

๊ฒฝ๊ณ  : ๋” ์ด์ƒ ์‚ฌ์šฉ๋˜์ง€ ์•Š์Œ : '@rest (path :'์— ':'์ฝœ๋ก ์ด ํฌํ•จ๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค.์ด ํ˜•์‹์€ ํ–ฅํ›„ ๋ฒ„์ „์—์„œ ์ œ๊ฑฐ๋ฉ๋‹ˆ๋‹ค.

๋ฌด์—‡์ด ๋ฌธ์ œ์ผ๊นŒ์š”?

[email protected]
[email protected]
[email protected]
[email protected]

questionโ”

๊ฐ€์žฅ ์œ ์šฉํ•œ ๋Œ“๊ธ€

๊ฒฝ๊ณ ๋ฅผ ์—†์• ๊ธฐ ์œ„ํ•ด ์ƒˆ ๊ตฌ๋ฌธ์œผ๋กœ ์—…๋ฐ์ดํŠธํ•ด์•ผํ•ฉ๋‹ˆ๋‹ค.

 @rest(type: "Person", path: "people/:id") {

๋œ๋‹ค

 @rest(type: "Person", path: "people/{args.id}") {

๋ชจ๋“  2 ๋Œ“๊ธ€

๊ฒฝ๊ณ ๋ฅผ ์—†์• ๊ธฐ ์œ„ํ•ด ์ƒˆ ๊ตฌ๋ฌธ์œผ๋กœ ์—…๋ฐ์ดํŠธํ•ด์•ผํ•ฉ๋‹ˆ๋‹ค.

 @rest(type: "Person", path: "people/:id") {

๋œ๋‹ค

 @rest(type: "Person", path: "people/{args.id}") {

์ข‹์€ ๋Œ€๋‹ต @dbryand!

์ด ํŽ˜์ด์ง€๊ฐ€ ๋„์›€์ด ๋˜์—ˆ๋‚˜์š”?
0 / 5 - 0 ๋“ฑ๊ธ‰