Back to home

LinksGetIn code
Expo Amplify main image

Expo Amplify

  • https://docs.aws.amazon.com/aws-mobile/latest/developerguide/mobile-hub-web-access-databases.html
  • https://medium.com/@jameshamann/serverless-react-web-app-with-aws-amplify-part-two-d740ee8e7456
1 2 3 4 5 6 7 8 9 10 11 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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 # 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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 // 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);

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 workingoutloud.dev, Den Dribbles and LandPad .

Related articles


1,200+ PEOPLE ALREADY JOINED ❤️️

Get fresh posts + news direct to your inbox.

No spam. We only send you relevant content.