Anyone successfully integrated AWS AppSync with Laravel?
I am new to AWS AppSync but good experience with laravel.
I am trying to implement an offline-app feature in my mobile app and the mobile API part is what Laravel handles.
I looked into AWS AppSync but all they are talking about is dynamoDB and graphQL. Someplace it says i need to use AWS Lambda.
I really can't get a grip on how to properly implement this.
Any suggestions or pieces of advice are greatly appreciated.
I have basic experience with graphQL
Thanks
I checked a few video sessions and found HTTP endpoint can be used as a resolver. is this the proper way?
If I use HTTP as resolver can I still use the real-time features?
links
https://aws.amazon.com/appsync/
Laravel is a PHP framework, so I think the two options you would want to consider would be HTTP and Lambda data sources.
Lambda can be something of a catch-all for data sources: you have absolute control over what you call, how you do it, and in what language you do it. You just have to set up a Lambda function and create a data source in the AppSync console pointing to it, then have your Lambda function interact with your framework however it needs to.
I'm not terribly familiar with Laravel myself, but I believe HTTP is also a totally viable option. I would think this would be the way you want to go, as it cuts out the added complexity and latency of a Lambda function between AppSync and your end destination. A tutorial for setting one up is available here: https://docs.aws.amazon.com/appsync/latest/devguide/tutorial-http-resolvers.html
In either case, real time updates will be absolutely available to you.
Related
I need to develop my backed application in NodeJS ExpressJS and GraphQL, and I am using the Apollo GraphQL server for this. Now I have to connect this GraphQL to ElasticSearch so that I can directly write the ElasticSearch Queries in Apollo Playground like earlier I was using for GraphQL Queries.
Can someone help me with this Scenario?
There are multiple scenarios for this through object manipulation, some use a dedicated file for elasticsearch and others use the logic directly to resolvers in graphql and then just add the main method in the graphql/nodejs server declaration in order for the initialization to start (index creation etc) (some call it index.ts it depends)
Use objects and single responsibility.
create a frontend observable that looks at an API that API can then take data from the elastic cluster.
The problem as you pointed out is that you use graphql directly, while graphql is mainly to create a layer between front and back, what you do is making the API layer connect directly with the back, so that needs to change through a new object that only exists for the API, no matter what happens to your back this will have to stay the same, that's why graphql is important, it needs to be used on that specific way.
Subject
I'm using amplify with GraphQL and DynamoDB as backend which works through AppSync. AppSync generates json based on vtl and executes it (I don't know in fact what part of the service executes it) - so it names as Resolver Mapping Template
I need to cover all my GraphQL endpoints with custom resolvers written by me but development hurts, cause I cannot find any workaround how to simplify development and testing except via aws console, what is slow and inconvenient
What I tried
As an approach I tried to create DynamoDB json files and upload them via awscli, but AppSync uses another json format - Resolver Mapping Template
What I need
I would like to know any workaround and guidelines how to develop, debug and test my resolvers.
So I need 2 options or both
Compare generated template with all $util stuff. nice to have
Execute generated template via cli into DynamoDB for checking results (or maybe there are any mock system). great to have
The recommendation would be to use the Amplify CLI to manage auto-creating the resolvers as well as updating them yourself to alleviate some of the 'development hurts' part.
I noticed that you mentioned one of the things you are looking for is the ability to rapidly test the resolvers (that in this case amplify cli will create for you) but as stated it will take some time with every amplify push for the cfn to update. What might interest in you (and potentially alleviate this issue for you) is this new RFC for the amplify cli: https://github.com/aws-amplify/amplify-cli/issues/1433
See if it covers your needs if not, add a comment to that github post.
I started to use graphQl with react relay. And I followed some tutorials and I can able to get and post with the help of mutations and queries. Everything works fine but my question here is,
Where qraphql is saving the data and fetching that for us
for example: If I get data from database mean's I can go through into particular DB/ TABLE. Likewise, i want to know where graphql is storing the data.
i searched many sites, They are telling how to use qraphql but I cant able to find an answer to my question. I need clarification in this area. Can someone help me out with this.
GraphQL is a query language for your API, and a server-side runtime for executing queries by using a type system you define for your data. GraphQL isn't tied to any specific database or storage engine and is instead backed by your existing code and data.
You can connect any database using GraphQL.
As I understand you are trying the mutation and queries with some hosted engines.
Please go through this reference and set up the GraphQL engine on your side.
GraphQL, unlike a database level query languages like SQL, is an application level query language. It's up to programmer to create necessary logic - in most server implementations realized by using resolver functions - to make a domain described by GraphQL Schema a reality. This includes any form of persistence.
The GraphQL is using localStorage provided by your browser by default if there is no other storage are provided.
I sort of understand how the graphql engine works with its querying ability etc.
How does graphql actually connect to the backend datastores like postgresql etc.
Is this a nodejs application or a more scalable backend written in java/golang could be used by graphql?
Sorry I'm not sure I understand the various components required to use graphql and hoping someone could explain that to me.
I believe if I understand it correctly you define the back-end for your GraphQL implementation. See here for supported languages: http://graphql.org/code/
One of the primary things GraphQL does is allow the client to define what gets returned rather than the Api, you build out your Api with the GraphQL libraries and define schemas to map your data logically.
Here's a good article that shows how this can be done with React for the client and Node for the back-end: https://www.sitepoint.com/graphql-overview/
I'm a beginner to javascript and GraphQL, looking to implement a simple app that interacts with a MySQL database and wraps a 3rd party REST API. GraphQL seems like the right fit, and Javascript has first party support.
To get started, should I use Apollo's GraphQL Server or mickhansen's graphql-sequelize (with his dataloader-sequelize) or write one from scratch?
In all cases it seems to use sequelize under the hood, which mickhansen is a major contributor to.
I'm looking for the advice and analysis of more experienced javascript and GraphQL programmers.
I realise the final decision is subjective but I'm looking for a thought out pro/con of all 3 different solutions.
Thanks in advance!
I would recommend not to start writing your server from scratch, but to use existing libraries and seed projects. Personally, I use Typescript with the Apollo stack, combined with several other libraries for splitting the schema to files, and auto-generating types.
This post demonstrates how to modularize your graphql server code, providing a seed project you can clone. Hope it helps! :)
I am currently using Apollo GraphQL with Sequelize. Sequelize is your ORM to interact with the DB, it can function with Apollo which takes care of your GraphQL. GraphQL is a thin api layer anyway. One problem i have been running into is dataloader implementation with vanilla Sequelize. I am trying to figure it out to get it working. I am hoping to work through it this week.