Skip to content

joseneto/scramble-backend

Repository files navigation

Clojure: Scramble Task

Build Status

This project it's a simple backend service that receive two strings and apply the scramble function that check if a of the strings can be rearranged with another

Libraries

Scramble Task use some open source libraries:

  • [Leininger] - A build automation and dependency management tool for Clojure
  • [Ring] - A libray for web applications
  • [Cheshire] - Json encode/decode
  • [Midje] - Great framework to create tests for Clojure

Install

Scramble Task require Leininger, you can download it here Leininger. You will need it to run the project, the installation is super simple, if you are using windows there is an installer here Leininger Windows Install

After install Leininger, you can go to your project root path and run the command below, Leining will install all dependecies.

$ lein deps

We are almost ready to run the project. If everything is ok, run the command below to start the service!

$ lein ring server-headless

Registred Services

There is a lot of tools to connect with the services, but I recommend Insomnia it's a great Rest client and you will love it.

Name Endpoint
Scramble [POST] localhost:3000\scramble

How you can use that services.

[POST] localhost:3000\scramble
{
	"str1" : "choco", 
	"str2": "cocho"	
}

Tests

Scramble Task was built using TDD(Test Driven Development), all development was guided by the tests, we have units tests and acceptance tests that can be easily executed running with midje.

Running all tests:

$ lein midje

Running only acceptance tests

$ lein midje :filter acceptance

Running only unit tests

$ lein midje :filter unit

Project Structure

The project was divided as follows:

  • [src/scramble_backend/handler.clj] - This is our main file, where all requests are packed and the routes are created.
  • [src/scramble_backend/middleware.clj] - Middleware created to manage CORS policy.
  • [src/scramble_backend/libs/string_library.clj] - This file contains the scramble functions.
  • [test/scramble_backend/auxiliary.clj] - File with some help functions for the tests.
  • [test/scramble_backend/acceptance_test.clj] - This file realize all acceptence tests.
  • [test/scramble_backend/unit_test.clj] - This file realize all unit tests.

About

Clojure Scramble Task

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published