Skip to content

reiswindy/kemal-realworld

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

80 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RealWorld Kemal App

Build Status

Example Crystal/Kemal codebase that implements the RealWorld spec and API.

Getting started

Requirements

Usage

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

Environment variables

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

Production

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

Testing

Specs

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

Integration

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.

Contributors

About

Exemplary real world backend API built with Crystal and Kemal

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Crystal 98.7%
  • CoffeeScript 1.3%