Example Crystal/Kemal codebase that implements the RealWorld spec and API.
Clone this repository and install its dependencies:
$ git clone [email protected]:reiswindy/kemal-realworld.git
$ cd kemal-realworld
$ shards install
Create a file named .env.development
and set up your database credentials. You may use the example file .env.dist
as a base for this:
$ cp .env.dist .env.development
Run Cake task dbmigrate
to set up the database schema. Internally, this task uses micrate to run the migrations in the db
folder:
$ cake dbmigrate
Build and run the server:
$ shards build realworld
$ bin/realworld
This repository uses cr-dotenv to set up the environment variables in non-production builds. You may specify which .env
to load by providing the APP_ENV
environment variable when running the server. By default this value is development
, and the file loaded is .env.development
as a result.
$ APP_ENV=integration bin/realworld # Will load .env.integration instead
When built in production mode, .env
files will no longer be loaded. All values will be taken from the system's environment variables.
To build and run the server in production mode:
$ APP_ENV=production shards build realworld --production --release --no-debug --progress --stats
$ bin/realworld
This repository uses spec-kemal for testing responses returned by Kemal. This requires setting the environment variable KEMAL_ENV
to test
when running Crystal's built in testing framework:
$ KEMAL_ENV=test crystal spec
This repository uses the integration test suite provided by https://github.com/gothinkster/realworld/tree/master/api in its Travis CI script. If the badge is currently green, all tests have passed.
- @humboldtux Benoit Benedetti - creator
- @reiswindy - creator, maintainer