Back to home

Expo Amplify

Published: Oct 22, 2018

Last updated: Oct 22, 2018

    npm install --global awsmobile-cli awsmobile configure # follow configure prompts yarn add aws-amplify aws-amplify-react-native awsmobile init awsmobile user-signin enable # might be awsmobile user-signin enable --prompt # to open console awsmobile console

    Get

    # Create awsmobile cloud-api invoke ServerlessExampleCRUD POST /ServerlessExample '{"body": {"ID": "1", "ItemDescription": "Description", "ItemName": "Item One", "ItemPrice": 99}}' # Another create awsmobile cloud-api invoke ServerlessExampleCRUD POST /ServerlessExample '{"body": {"ID": "2", "ItemDescription": "Description", "ItemName": "Item Two", "ItemPrice": 99, "userId": "dennisokeeffe"}}' # Get awsmobile cloud-api invoke ServerlessExampleCRUD GET /ServerlessExample/object/1 { ItemPrice: 99, ItemName: 'Item One', ID: '1', ItemDescription: 'Description', userId: 'UNAUTH' }

    In code

    This code will also ensure that only the user can see the info

    // Create something only the user can see if user only on let create = await API.post("ServerlessExampleCRUD", "/ServerlessExample", { body: { ID: "3", ItemDescription: "Description", ItemName: "Item Three", ItemPrice: 99, }, }); console.log(create); // Fetch if only user can fetch let counter = await API.get( "ServerlessExampleCRUD", "/ServerlessExample/object/3", {} ); console.log("> CounterOne.counter", counter);

    Personal image

    Dennis O'Keeffe

    @dennisokeeffe92
    • Melbourne, Australia

    Hi, I am a professional Software Engineer. Formerly of Culture Amp, UsabilityHub, Present Company and NightGuru.
    I am currently working on Visibuild.

    1,200+ PEOPLE ALREADY JOINED ❤️️

    Get fresh posts + news direct to your inbox.

    No spam. We only send you relevant content.

    Expo Amplify

    Introduction

    Share this post