Posts

Showing posts from 2019

simple graphql with scala.js, zio and apollo-server-express

simple graphql with scala.js, zio and apollo-server-express WIP - please ignore this blog until its done or check back periodically for new content. REST is a bit on its way out, if its not out already. Graphql has been where the action has been at for a few years now. graphql is relatively easy to use and significantly more express than say, odata. It’s relatively straight forward to create a simple graphql server that uses a RDBMS behind the scenes. If you use the express version of the apollo server library you can get instant reload, solid debugging and other features that makes it easy to use and adopt. While express is not multi-threaded, it may be good enough as a solution. There are quite a few graphql libaries: apollo-graphql-express: From community and a backing company. graphql-express: From FB + Relay. graphql-yoga: Dev friendly, fast starter graphql database. sangria: scala calahan: scala + zio (newer) …endless list by language… We will use ...

http server: node.js, express, zio, error channels, mixed code base

http server: node.js, express, zio, error channels, mixed code base This is a quick blog on integrating zio into node.js+express and scala.js. It also shows you how to align the zio error channel with the semantics of the domain. An explicit goal is to enable scala.js and zio in a mixed code base. You would normally create a http server using one of the many scala+jvm based libraries. play, cask, akka-http or http4s. They are all good and integrate well with scala. Most of them allow you choose the underlying java http server library. The scala layer is typically an API layer on top. I like the idea that cask is focused on making it quick and simple to build websites even although cask is not asynchronous. Allowing you to start small and quick then incrementally build out your server’s logic is a good way to get programmers started and allow them to grow their usage as their understanding of the API increases. node.js+express is like that. Although it is easy to ...

zio environment and modules pattern: zio, scala.js, react, query management

zio environment and modules pattern: zio, scala.js, react, query management This blog covers a zio-based fetch design for scala.js, react web applications. It heavily uses the zio “environment” feature to help motivate a point of view on the modules pattern in effect systems. At the end, I summarize some thoughts on ergonomics and complexity. This blog assumes a basic knowledge of zio and react. scala.js is just like scala so you mostly already know scala.js. This blog is a follow-on to previous blogs: https://appddeevvmeanderings.blogspot.com/2019/10/scalajs-react-fetcher-hook_48.html and https://appddeevvmeanderings.blogspot.com/2019/11/scalajs-and-react-suspense.html . I have been keeping an eye on and culling ideas from typscript/javascript fetching libraries that address query management concerns. The formulation below incorporates some of those concerns but does not try to comprehensively duplicate well established javascript libraries. I only care about ...