Git Product home page Git Product logo

readerm's Introduction

ReaderM

This is a toy project which I made for demonstrate some concepts in my blog. It will be evolving with new functionalities that I'm going to explore.

This is a runnable microservice built with the following stack of technologies:

Of course, on top of Scala (2.12.2).

This MS models a music domain: it documents my favourite artists, bands (not the same as artists), albums and songs. This because of my lack of ideas for a domain ๐Ÿ˜…, but it'll be enough for demonstration purposes.

You can run the API typing the following commands in your terminal (using revolver):

$ sbt
> reStart

With this command you are starting a forked JVM which can be killed or reStart'd without killing your sbt session. That means that you can type in any moment reStart for re-starting your application if you've made any change.

Also, you can run the application in the old-fashioned way:

$ sbt
> run

The service will be listening on port 7101.

The requests (in the actual version) that you can issue are:

  • [GET] http://localhost:7101/api/artists to list all the artists available in the database.
  • [GET] http://localhost:7101/api/artists?id=<id> to query an artist by his/her ID in the database.
  • [GET] http://localhost:7101/api/artists?name=<name> to query an artist by his/her EXACT name.
  • [POST] http://localhost:7101/api/artists to create a new artist in the database
  • [PUT] http://localhost:7101/api/artists to update

All the examples and the entities for creating and updating an artists are included in the project root as a Postman collection if you want to take a look and test it for yourself.

Database initialization

This first version assumes that you have a local installation of PostgreSQL running in your machine with the default user/schema (postgres). You can run the DDL_PG.sql script (located in the SQL/ folder of this project) in that schema to create all the database model and then run the DML_PG.sql that contains a very basic dataset. This is not yet automated, but it will in future versions, so you don't have to do it by hand.

If you are running macOS you can use the excellent Postgres.app that runs a complete instance of the database in your machine without configuring or messing up with a new installation of PG.

In other OS's you need to install the Database engine and execute the scripts mentioned above.

REMEMBER: the model is created in the postgres default schema.

Disclaimer

As noted before, this is a toy project, so, things like exception handling, exception messages and so on can fail abruptly. This is going to be improved in future versions of this project. Again, the code here is only for demonstration purposes and it isn't intended for production use (yet?).

License

The code in this repository is licensed under the MIT license. If you don't understand what does that means, here's an excerpt from choosealicense:

A short and simple permissive license with conditions only requiring preservation of copyright and license notices. Licensed works, modifications, and larger works may be distributed under different terms and without source code.

And that's it :) If you have questions you can get in touch with me on Twitter.

AME.

readerm's People

Contributors

alejandromarin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

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.