Giter VIP home page Giter VIP logo

shortly's Introduction

Shortly

Shortly is a micro service to shorten urls, in the style that TinyURL and bit.ly made popular.

We took Ruby off the Rails. Don't tell Mom. Shortly stores data in Postgresql, but without ActiveRecord (it uses the lightweight ORM Sequel instead). The API is served by Sinatra. Because Francis is lazy, we still load ActiveSupport.

Setup

Shortly only speaks JSON. Get yourself a browser extension that formats JSON nicely, or this won't be nearly as much fun for you as it was for us.

0. Install dependencies

If you don't already have them, install the following (perferably using homebrew):

  • postgres

1. Clone the repo and install gems

git clone https://github.com/FrancisPlaza/shortly.git
bundle install

2. Set up the databases

cp config/database.yml.sample config/database.yml
createdb shortly_development
createdb shortly_test

If you have a non-standard setup, you may need to change some things in config/database.yml.

There is a database task to migrate your database. This is a self-contained task that can migrate your database to the currently-required format. It does not make use of the migrations you might be used to from ActiveRecord. See lib/tasks/db.rake.

bundle exec rake db:migrate

Note that this task does not automatically migrate your test database; you will need to explicity run this task with RACK_ENV=test.

4. Start a web server

Pow works just fine. Alternately, you can run bundle exec rake server which will instantiate a Puma webserver running at port 3000 by default.

Running tests

You can run the RSpec tests by simply doing rspec in the root of the project.

Console Access

bundle exec rake console

Misc notes

use RACK_ENV, not RAILS_ENV

shortly's People

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.