Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Amplify山あり_谷あり奮闘記.pdf

 Amplify山あり_谷あり奮闘記.pdf

j-yamamoto

July 31, 2020
Tweet

Other Decks in Technology

Transcript

  1. • ࢯ໊ɿࢁຊ ४ • ॴଐɿ φΠϧגࣜձࣾ ϞϏϦςΟαʔϏεࣄۀ෦ • ΤϯδχΞྺɿ೥ •

    "84ར༻ྺɿ೥ • ࠷ۙͷझຯɿ Ϛʔέλʔͷ࠺ʹ42-Λڭ͑Δ͜ͱ ࣗݾ঺հ
  2. "NQMJGZ'SBNFXPSLͰαΫοͱόο ΫΤϯυϑϩϯτΤϯυ࣮૷ʂ import API from "@aws-amplify/api"; const awsconfig = require("./aws-exports").default;

    API.configure(awsconfig); const runAPI = async () => { return await API.get('TestAPI', '/api/test', {}); }; "NQMJGZ'SBNFXPSLͷ"1*Ϟδϡʔϧ ΛϑϩϯτͰར༻͠ɺαΫοͱ"1*࣮ߦ $ amplify init $ amplify api update $ amplify push ίϚϯυͰ-BNCEBؔ਺࡞੒ˍσϓϩΠ var express = require('express') var bodyParser = require('body-parser') var awsServerlessExpressMiddleware = require('aws-serverless-express/middleware') // declare a new express app var app = express() app.use(bodyParser.json()) app.use(awsServerlessExpressMiddleware.eventContext()) // Enable CORS for all methods app.use(function(req, res, next) { res.header("Access-Control-Allow-Origin", "*") res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept") next() }); /********************** * Example get method * **********************/ app.get('/api/test', function(req, res) { // Add your code here res.json({success: 'get call succeed!', url: req.url}); }); -BNCEB༻ͷ&YQSFTTϑϨʔϜϫʔΫͰ࣮૷
  3. ͸·ͬͨϙΠϯτᶃ 1BSBNFUFS4UPSFͰղܾʂ ຊ൪ εςʔδϯά ։ൃ 1BSBNFUFS 4UPSF "84"NQMJGZ όοΫΤϯυ "84"NQMJGZ

    όοΫΤϯυ "84"NQMJGZ όοΫΤϯυ ᶃύϥϝʔλ஋Λొ࿥ ᶄσϓϩΠ࣌ʹ ύϥϝʔλऔಘ
  4. ͸·ͬͨϙΠϯτᶄ ผܥ౷ͷ4όέοτͷར༻ʹۤઓ DBSNPKQ ը૾༻ 4όέοτ ϗεςΟϯά༻ 4όέοτ ը૾ߋ৽ όονॲཧ DBSNPKQ

    ը૾༻ 4όέοτ ϗεςΟϯά༻ 4όέοτ ը૾ߋ৽ όονॲཧ ඥ෇͚ෆՄ چߏ੒ ༧ఆ͍ͯͨ͠ߏ੒
  5. ͸·ͬͨϙΠϯτᶄ $MPVE'SPOUΛઌ಄ʹ௥ՃͰճආ DBSNPKQ ը૾༻ 4όέοτ ϗεςΟϯά༻ 4όέοτ ը૾ߋ৽ όονॲཧ ը૾༻

    4όέοτ ϗεςΟϯά༻ 4όέοτ ը૾ߋ৽ όονॲཧ DBSNPKQ ඥ෇͚Մೳ چߏ੒ ৽ߏ੒