generator-scalatra

A Yeoman generator for Scalatra project

npm install generator-scalatra
1 downloads in the last day
1 downloads in the last week
18 downloads in the last month

generator-scalatra

Build Status NPM version

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.

Getting Started

What is Yeoman?

$ npm install -g yo

Usage

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

If you selected MongoDB you need to have MongoDB running, if not you can skip this

$ 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!'})

Start and scan for changes:

$ ./sbt
> ~;container:start; container:reload /

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

Run tests

$ ./sbt
> test

Changelog

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
    

License

MIT @ Peter Vilja

npm loves you