Skip to content

Hempy49/palindrome_database

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Palindrome Database Tech Test

Prerequisites

Postgresql development package

Macs OSX (with home brew)

brew install postgresql

Linux

yum install postgresql-devel

Windows

nope, sorry ¯\_(ツ)_/¯

Specifications

Build a service that stores a number of palindromes. A palindrome is a word or phrase string that reads the same backwards as forwards, independent of spaces and punctuation. An example could be 'Dammit I'm Mad'. The service has a simple REST interface that presents two endpoints:

  • An endpoint that accepts a string parameter, that will return true if the string is palindrome (and false otherwise).

  • An endpoint that returns a list of the last 10 palindromes the system has received in the last 10 minutes.

Approach

The project was written in Ruby on Rails following a TDD approach. This was a fun project that consolidated some of my rails knowledge. With more time I would like to work on extending this project to add user authentication so that users can read, update and delete their palindromes when logged in. A more exciting front-end built using a library like react.js, would also improve this web app.

How to use

First clone this repo. Then:

bundle install
# assuming your postgres instance is running
bin/rails db:create
bin/rails db:migrate

bundle exec rspec # Run the tests to ensure it works
bin/rails server # Start the server at localhost:3000

Screenshots

Palindrome successfully saved in database:

screen shot 2017-10-01 at 18 53 56

Error when user tries to add string that is not a palindrome:

screen shot 2017-10-01 at 18 55 07

Passing rspec tests:

screen shot 2017-10-01 at 18 56 53

About

A service that stores a number of palindromes, built in rails.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •