Appsync Javascript client choice - aws-appsync

I would like to use straight forward vanilla JavaScript to create an AppSync web client front end. All the examples seem to demonstrate using React. Do you have to use a JavaScript framework? Any pointers to a good resouce would be welcome

I would recommend checking out Amplify - https://github.com/aws-amplify/amplify-js
But if you wish to wish remain as "vanilla" as possible then you will have to use the AWS JS SDK. https://github.com/aws/aws-sdk-js

Related

How to consume REST with GET and POST

Is there a standard out-of-the-box way to access an API using GET or POST in TypeScript?
I only find libaries that do that like fetch or superagent suggested here when using React or HttpClient suggested here when using React.
I wonder though if there is a plain an simple way from within TypeScript to consume a REST API.
I wonder though if there is a plain an simple way from within TypeScript to consume a REST API.
Lets simplify REST API to be *I want to make GET and POST requests. The fact that it is a REST style API is not relevant.
I want to make GET and POST requests
Native ways of doing this depends on the JavaScript environment. e.g. Browser's traditional API has been XMLHttpRqeuest : https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest which is fully supported by TypeScript. A newer API is fetch which is also supported by TypeScript but might not be supported by the browser you are targetting.
On node you would use http module https://nodejs.org/api/http.html
Suggestion
Now if you want an API that works across both node and old browsers you will need some library that abstracts the native features. One suggestion is axios which works with TypeScript out of the box.

Actions on Google where to start with no experience in JSON

Where I can learn about actions on google? I have read the documentations but still confused I don't have any experience in JSON
Actions on Google provides a convenient Node.js client library, which handles all the Conversation API JSON payloads for you. You can just use the high-level client library API instead: https://github.com/actions-on-google/actions-on-google-nodejs
Start by reading about JSON and understanding it, you should probably get to know some basic JavaScript.
This is a very basic getting started website:
https://www.w3schools.com/js/js_json_intro.asp
If your using Java or Kotlin (or any lang on JVM really) you can use the unofficial Kotlin/Java SDK - https://github.com/TicketmasterMobileStudio/actions-on-google-kotlin

Angular2 + Scala Play2?

I am somewhat new to the domain of web development. I am investigating Play2 and am trying to understand, do you need some kind of JS frontend framework to go with Play2 and Scala?
I notice that Play2 has a template engine, but it seems that it generates the HTML on the server and sends it to the browser. Does this mean that the need for a JS frontend like Angular2 is made irrelevant? Or is there still a reason to use Angular2 in a Play2 application? What instances would it make sense and why?
I have some experience of using Play 2 with AngularJS (currently rewriting frontend to Angular2).
I use Play 2 (scala) only for RESTful JSON backend, which is just great for this purpose and I use Angular for single page application frontend. I find this combination brilliant.
My project is hosted on GitHub, you can check it out here
There are three directories in the root:
restful with all backend stuff, written in scala, using Slick for DB,
taking advantage of Play evolutions and all other stuff.
angularjs-client-deprecated with AngularJS code. I used angular-resource for making calls to backend.
client with Angular2 code. There is nothing there so far except for my experiments, however I've written a simple service for authentication with security token.
To summarise, I've been developing my project for almost 2 months so far, mainly to learn both Scala and AngularJS (now Angular2).
If you're planning to use JS framework for frontend, I would recommend you to use Play2 only for RESTFul Json backend. I don't see a reason to use Play2 html template engine in this case.
Play is more about Server Side templating, which isn't all that useful if you're using Angular. It can be done, but it comes with some overhead. I've worked with Scalatra in the past and it worked really well for me.
http://scalatra.org/
Other options include Spray, which is very similar from the outside, but uses Akka internally and uses non-blocking I/O, similar to Play!
http://spray.io/
With angular it is better to go with simple rest/http api like Akka-IO or spray for data and other stuff. Play will be less relevant with Angular.
As others have pointed out Play2 isn't really the best option for building responsive websites. I have a seed project which can help you get started with Akka Http and Angular 5...already configured to deploy to Heroku in a single web dyno.
https://github.com/jdschmitt/akka-angular-heroku
Check it out. I hope it helps anyone landing here looking for a way to manage back-end and front-end in a single repo for simple projects.

For a Single Page Application: ExpressJS or Restify or both?

I'm working with NodeJS + Mongoose, writing a Single Page Application, so I need to serve some statics and then all the interaction between frontend and backend is done via XHR. Eventually I'm thinking about writing a native mobile app accessing the same backend. Is there any pattern / best practice I should apply here?, I thought that I may need to extract the API to be exposed via Restify, and handle the requests from the webapp only with ExpressJS? or should I just put all the stuff exposed via Restify? I guess my confusion comes from not being worked with Restify before, so any explanation about how is it different from ExpressJS (specially when talking about a Single Page App) is really welcome.
I am implementing a similar solution, mobile app & website with expressjs and backbonejs. I did not use restify because i did not think i needed the extra complexity, there were not that many API endpoints so expressjs handled everything ok for me.
BTW take a look at this post on restify performance, I just saw it today and have not personally validate the contents.
Benchmarking APIs using PerfectAPI vs Express.js vs Restify.js « « PerfectAPI Blog PerfectAPI Blog http://bit.ly/xrTguB
Restify is packaging DTrace and various handlers that Express doesn't. If you just have one API endpoint and don't need DTrace, it doesn't make sense to run Restify.
Also, you might want to try express-resource

Access Google Docs Spreadsheet from GWT

I want to use a Google Docs Spreadsheet as a key-value store from GWT, what is the best way to implement this? I don't think I can use the Google API Client Library for Java since that seems to be a client-side Java library and uses java.net.HttpURLConnection. Would I have to use JSNI and the Javascript client?
Using JSNI and the JavaScript client is probably the best way. Another option would be to use the Java client on your server and proxy API calls through it from your client, but that seems unnecessary.