Add this library to your projects dependencies along with the driver in your shard.yml. This can be used with any framework but was originally designed to work with the amber framework in mind. This library will work with Kemal or any other framework as well.
1
dependencies:
2
granite:
3
github: amberframework/granite
4
5
# Pick your database
6
mysql:
7
github: crystal-lang/crystal-mysql
8
9
sqlite3:
10
github: crystal-lang/crystal-sqlite3
11
12
pg:
13
github: will/crystal-pg
Copied!
Register a Connection
Next you will need to register a connection. This should be one of the first things in your main Crystal file, before Granite is required.