Coder Social home page Coder Social logo

loicdescotte / purewebappsample Goto Github PK

View Code? Open in Web Editor NEW
125.0 9.0 7.0 52 KB

Minimal http4s + Doobie + ZIO + Circe Scala application to show how to build a purely functional web application in Scala.

Scala 97.33% TSQL 2.67%
http4s doobie scala pure functional io

purewebappsample's Introduction

Simple ZIO + HTTP4s + Doobie + Circe POC to show how to build a purely functional web application in Scala, using functional effects with ZIO.

This is just an example to show how to retrieve and update a stock value in a database, validate this value ( > 0) and return a result as json.

How to run the sample :

purewebappsample's People

Contributors

loicdescotte avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

purewebappsample's Issues

App crashes, when a not existing stock id is chosen

When you call an HTTP-GET on http://localhost:8080/stock/5 an SQL error occurs due to the fact, that an empty result is returned.

Error
ResultSet exhausted; more rows expected

Response

{
"Error": "org.h2.jdbc.JdbcSQLException: Table \"STOCK\" already exists; SQL statement:\nCREATE TABLE stock\r\n(\r\n    id INT NOT NULL AUTO_INCREMENT,\r\n    value INT NOT NULL,\r\n    PRIMARY KEY(id)\r\n) [42101-196]"
}```

It looks like the transactor driver manager restarts and tries to re-run the ```create.sql`` even though the database was not reseted. 

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.