Skip to content

Commit

Permalink
Merge branch 'master' of github.com:van-clj/thoth
Browse files Browse the repository at this point in the history
  • Loading branch information
rafael committed Mar 7, 2012
2 parents 273de34 + 7548f15 commit dbe51e3
Showing 1 changed file with 28 additions and 19 deletions.
47 changes: 28 additions & 19 deletions README.md
@@ -1,14 +1,15 @@
# Thoth
# thoth [![Build Status](https://secure.travis-ci.org/van-clj/thoth.png)](https://secure.travis-ci.org/van-clj/thoth.png)

A simple URL shortner written in clojure and built on top of noir and mongodb.

A simple URL shortner using noir, mongodb and thinked to be deployed to Heroku.
The URLs are shortened using a base62 strings as ids.

## Usage

First go to src/thoth/config.clj and set your environments for production,
First go to *src/thoth/config.clj* and set your environments for production,
development and test. Basically you need to provide the following:

* An un url with mongo credentials to use.
* An url with mongo credentials to use.
* An auth-token used to validate requests when creating shortened urls.

After this, you need to set an environment variable to the desired environment:
Expand All @@ -22,24 +23,11 @@ lein deps
lein run
```

### Instructions to deploy to Heroku.

By default, the config file in production enviroment will try to look for a
herokuhq environment variable. So setting up the application to heroku should
be as simple as (assuming you have heroku alredy configured):

1. git clone thoth.
2. cd thoth.
3. heroku create --stack cedar
4. git push heroku master
5. heroku addons:add mongohq:free
6. heroku config:add APP_ENV=production

That should be it! Now your app should be working.

### Thoth API instructions.
## Thoth API instructions.

## Creating a shortened url
### Creating a shortened url

To shorten an url you must do a post method to the url "/shortify" of your app with the following
parameters:
Expand All @@ -54,16 +42,37 @@ Example with cURL:
```

The response should be a json like these:

```json
{"shortened_url":"1lQ","url":"http://www.google.com"}
```

Where shortened_url is the shortened id.

### Retrieving an URL.

Then you just need to do a GET request to your shortener with that id and it
should redirect to the original url:

```bash
curl -i http://myshort.cl/1lQ
```

## Instructions to deploy to Heroku.

By default, the config file in production enviroment will try to look for a
herokuhq environment variable. So setting up the application to heroku should
be as simple as (assuming you have heroku alredy configured):

1. git clone thoth.
2. cd thoth.
3. heroku create --stack cedar
4. git push heroku master
5. heroku addons:add mongohq:free
6. heroku config:add APP_ENV=production



## License

Copyright (C) 2012 Rafael Chacón
Expand Down

0 comments on commit dbe51e3

Please sign in to comment.