Can we build a full stack webapp with kotlin? - kotlin

Kotlin official documentation tells that it supports web development. And its replacement for java. I am trying to build a web application using Kotlin. So far I read so many blogs, courses and videos in YouTube but I did not succeed coming up with a flow. I came across this link https://medium.com/bcgdv-engineering/building-a-full-stack-web-app-in-kotlin-af8e8fe1f5dc and I could not proceed with this alone. I only need a front end and connect to my server with normal http request. Is there any right way of doing a web app in kotlin. Please help me with this. Thanks in advance!

What I use for developing web apps in Ktor:
Front-End:
FreeMaker - for templating (mustache and velocity are other options)
Bootstrap - for HTML - CSS - Javascript part
There is also Kotlinx.html and KotlinJS if you need to write them Kotlin Style and they are official toolset from JetBrains.
Kotlinx.HTML Github
KotlinJS
You can add functionality to Ktor itself (they are called features):
Features:
GSON - for content negotiation (converting Kotlin to JSON and visa versa)
Locations - for type-safe routing
Exposed (Interface for easily working with PostgreSQL, MySQL and SQLite that works based on JDBC drivers)
Authentication (for user auth)
Ktor website has detail documentation for all of these features and adding them in your project is so easy.
Add the dependency
install(FEATURE) in Application.
For the IDE side:
IntelliJ Ultimate (Ultimate supports .ftl for FreeMarker)
Ktor plugin which is a must-have when you install IntelliJ
For webserver engine:
Netty (I use this one)
Tomcat
Jetty
You can easily develop API and Wen Apps using Ktor amazing DSL (Domain Specific Language)
The only problem that I have is with Kotlin Coroutines which I hate, and prefer RxKotlin for developing asynchronous apps, it seems that's possible but there are not enough tutorials and samples out there to get started with it.
+ If you stuck on something new and challenging, you are on your own, as there are not enough samples and guides on the internet.
But at the end of the day, I only recommend Ktor to those android developers who don't want to learn web development language e.g. PHP, Phyton, Javascript, like myself.

Related

How to integrate a videocall API with Wordpress?

I am having some problem in understand how to integrate a videocall API with a Wordpress site.
I am developing a website which has a "meeting room", this site is built using Wordpress. I am trying to use some videocalls APIs, but couldn't understand the steps in order to integrate with de Worpress. Do I have to build a plugin?
I know some existing plugins for videocall, but they do not have the features I need, therefore I found some videocalls APIs that have the features I need. I also know how to embbed a videocall using iframe.
Thanks in advance.
If you decide to write your own video communication plugin using WebRTC technology, pay attention to:
select signaling for videochat
creating of Turn server
try this example: https://wordpress.org/plugins/wp-webrtc2/

Tendermint web application - customize

I am new to blockchain development and to tendermint as well.
I already have a blockchain running locally.
Using this command starport scaffold vue I could mount a local web application. Inspecting a bit I could replicate some network requests (localhost) and I can get the ballance of current wallet (hard-coded on the request), get the current wallet from the localstorage. I'm struggling on authentication (mnemonic, wallet name and password).
However I also would like to costumize it according to my needs and I thought I could start a web application from scratch. I can see that the generated web project is importing this project https://github.com/tendermint/vue which is making a lot of "magic behind the scenes" and importing UI elements as well and I would like to have my own elements.
I don't want to re-invent the wheel and I can make some imports to help me on connection to wallet, validate authentication (mnemonic, wallet name and password), create wallet and so on.
I am trying to build a web application to connect to wallet, make transations.... but I would like to control the styles and the connections (and if possible using reactjs instead of vuejs, otherwise I dont mind learn vuejs as well).
Is this possible or reasonable? Where I can find good documentation or tutorial to guide me on customize a web application using tendermint. Honestly I searched but I am kind of lost.
Thanks
UPDATE: I found good examples and here and here. It helped me to validate mnemonics and make transactions, with my stack tech.
Because Starport generates both plain Javascript and VUE controllers, you have few options:
Create your own site re-using VUE components
Take plain JS part and build a website using whatever technology you like
Use a plain JS client for standard cosmos modules you can find on GitHub
Use Protobuf generator to generate light client code yourself
If you only need wallet functionality, #2 and #3 may work best for you because the bank module is stable and hasn't changed much in a long time.
You can find plain JS file for bank in your project:
vue/src/store/generated/cosmos/cosmos-sdk/cosmos.bank.v1beta1/module/index.ts
There is a link to starport discord channel related to frontend: https://discord.gg/CvbdYh9AWQ

Hybrid Frameworks - differences in HTML5 API access "standard" HTML5 vs. plugins

I'm doing some research right now, trying to figure out the core differences in accessing device API's using a hybrid framework like Ionic. As far as I know, there are two ways for accessing an API through HTML5:
via "standard" HTML5 API
via plugin
Since an access using HTML5 runs from inside the webview, I keep reading it is performing worse. That seems to depend on the fact, that you are actually running a webview inside a native app. That's why hybrid is slower than native, cause native does access directly from the context of the app. Where do i put plugins in that scenario? Are plugins designed like small API's to the devices libraries that do access the native features from outside the web view? And what are the benefits in terms of performance and why?
Or am I just getting stuff mixed up and the "standard" HTML5 API access works through a plugin as well?
Thanks in advance!
Kolja

Automation in Go Lang - How to use browser automation like Selenium?

I am new to Golang. And I am looking for automating signup, login processes in a web app. Please suggest a good tool like Selenium and how can I implement it in the go language.
I want to do the following process automatically using Golang:
Start a browser. Currently, I'm using https://github.com/skratchdot/open-golang
Auto entry on the signup page and auto-submit a form.
Login check for the registered user. Everything needs to be done automatically for more users.
You can also use Playwright for Go, which is a wrapper for the Playwright project. Playwright provides a single API to automate Chromium, Firefox, and WebKit to automate browsers which was created by Microsoft. With it you interact with the sites, record videos, make screenshots, and emulate other browser specific behaviour.
If you are going to use GO for web automation testing - Selenium is a good option. Still it's nothing more than a library that allows you to interact with browsers. So you are going to need to develop your own framework or reuse someone already implemented.
My advice is to consider Agouti, since it supports Ginkgo BDD and xUnit Gomega. Everything else is pretty much the same from architectural perspective. You can design it like any other language binding. There are common patterns that appear over and over again in browser automation frameworks, like
PageObjects: A simple abstraction of the UI of your web app.
LoadableComponent: Modeling PageObjects as components.
BotStyleTests: command-based approach
Another good resource for building your Test framework is the xunitpatterns guide. It gives a great content overview of the patterns, smells and refactoring strategies you can use. Also look at this test frameworks tutorial. It'll help you choose the most proper solution for your case.
My guess is that you are going to need some CI server support for
everything needs to be done auto for more users.
Here is a good article how-to achieve this with TravisCI.
update:
you can use Selenium for Golang

Building a Custom API on top of Parse.com?

I'm planning on building a developer API similar to what Uber and Yo have done. Is it possible to build such API if my app's backend is powered by parse.com? I don't want my custom API pointing to parse, but instead my own site.
I'm planning on using ruby, and was wondering if there would be any limitations over other options (not sure what options I have). Thanks
I'm not sure if it is possible using ruby, but I know it's definitely possible to build your own REST API.
We have decided to go a bit further and wrote a parse-angular seed project for developing web apps. It can be found here.
After you pulled it, do a npm install
As usual,
cloud code should go into cloud/main.js
express code: cloud/app.js
angular code: cloud/public/js/
Note that: You will need to change your AppId and AppKey in
config/global.json
cloud/public/js/app.js
As for custom apis, you can define your own in cloud/routes/api.js.
At this point you should have a nice parse-angular project set up and good to go.
If there's anything wrong, please feel free to open a pull request. :)