generator-scalatra

A Yeoman generator for Scalatra project

generator-scalatra

Generates a basic structure for Scalatra REST Application and includes Casbah for MongoDB if you wish.

An example structure of generated project.

.
├── project
│   ├── build.properties
│   └── build.scala
|   └── plugins.sbt
├── README.md
├── sbt
├── src
    ├── main
    |   ├── resources
    |   └── scala
    |   |   ├── com
    |   |   |   └── example
    |   |   |       └── app
    |   |   |           └── controllers
    |   |   |               └── MessageController.scala
    |   |   └── ScalatraBootstrap.scala
    |   └── webapp
    |       └── WEB-INF
    |           └── web.xml
    └── test
        └── scala
            └── com
                └── example
                    └── app
                        └── controllers
                            └── MessageControllerSpec.scala

A generator for Yeoman.

What is Yeoman?

$ npm install -g yo

To install generator-scalatra from npm, run:

$ npm install -g generator-scalatra

Or search generator-scalatra under yeoman.

Make a new directory and cd into it:

mkdir new-project && cd $_

Finally, initiate the generator:

$ yo scalatra
$ mongod

Create db, collection and insert new message (Optional).

Application will use project name to create db, if the db doesn´t already exist.

$ mongo
> use <project name>
> db.createCollection('messages')
> db.messages.insert({body: 'Hello Mongo World!'})
$ ./sbt
> ~;container:start; container:reload /

Check it out at http://localhost:8080/messages

$ ./sbt
> test

This Changelog follows Semantic Versioning http://semver.org

  • 0.4.1 * Scalatra version upgraded to 2.2.2
  • 0.4.0 * Included option for Casbah and MongoDB * Minor fixes to files´ package paths
  • 0.3.2 * Fixed documentation
  • 0.3.1 * Minor refactoring
  • 0.3.0 * Add a 'controllers' folder * Renamed default servlet name * Improved documentation

MIT @ Peter Vilja