Skip to content

react-native-village/dataStore

Repository files navigation

DataStore AWS Amplify

Step 1 - Fast start example

Clone repository

git clone git@github.com:react-native-village/dataStore.git

Let's go to the example folder

cd dataStore

Install dependencies

yarn

or

npm install

Step 2 - Register your AWS account

We register according to this instruction 📃 and check all 5 steps according to the video tutorial.. Attention!!! You will need a bank card 💳, where should be more than 1 $ 💵 There we look and put the Amplify Command Line Interface (CLI)

Step 3 - Init Amplify

amplify init

amplify init

Step 4 - Connecting Authentication Plugin — Auth 🔐

Now that the application is in the cloud, you can add some features, such as allowing users to register with our application and log in. We connect the authentication plugin.

amplify add auth

Select the default configuration. This adds auth resource configurations locally to your amplify/backend/auth directory. Select the profile we want to use. default. Enter and how users will log in. Email (write off money for SMS).

auth

Successfully added resource yourname locally Send changes to the cloud 💭

amplify push

✔ All resources are updated in the cloud

Details

Stap 5 - Backend - Create an API

We will now create the GraphQL API, which interacts with the DynamoDB NoSQL database to perform CRUD operations (create, read, update, delete).

amplify add api

api

After the selected items, a diagram will open, which is always available for editing at ./amplify/backend/api/messaga/schema.graphql Where we add the following code:

type Job 
  @model
  @auth(
    rules: [
      {allow: owner, ownerField: "owner", operations: [create, update, delete]},
    ])
{
  id: ID!
  position: String!
  rate: Int!
  description: String!
  owner: String
}

This is a GraphQL schema. GraphQL Transform provides an easy-to-use abstraction that helps you quickly create server parts for web and mobile applications in AWS. Using GraphQL Transform, you define the data model of your application using the GraphQL Schema Definition Language (SDL), and the library handles the conversion of the SDL definition to a set of fully descriptive AWS CloudFormation templates that implement your data model.

It's time to test it in practice! Therefore, we write the command in the console

amplify mock api

mockapi

With this team, you can quickly test your achievements of change without the need to allocate or update the cloud resources that you use at each stage. In this way, you can configure unit and integration tests that can be performed quickly without affecting your cloud backend.

Send changes to the cloud 💭

amplify push

✔ All resources are updated in the cloud

Details

Step 6 - We start the project 🚀

iOS

react-native run-ios

Android

react-native run-android

Troubleshooting

If incomprehensible errors appear, it means that somewhere you made a mistake in the configuration, so it is better to start from the beginning.

  1. Delete the amplfy folder

rm -rf amplify

  1. Delete the amplfy configuration file

rm -rf aws-exports.js

  1. We go through these steps again

Done ✅

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published