How to get an OpenRasta up and running

03. March 2012 Howto 1
It’s been a while since I have created an OpenRasta project from scratch. And, back when I created my first one I didn’t really want to use OpenWrap, mostly because I was impatient and just wanted to start coding.  There are a few tutorials out there on how to create “Your First OpenRasta Application”  

However, as I was getting ready to give a talk on using OpenRasta for your RESTful APIs I thought it would be best if I actually started from scratch again.  That way, if anyone listening to my talk had questions about how to create a new one, I wouldn’t be telling them something outdated.

Turns out it’s a lot easier now that I made it out to be. 

First things first, head over to OpenWrap and follow their installation instructions to get it up and going.

Once you’ve got that done, you’re only a couple steps from having OpenRasta running out of the box.

Initialize the Wrap

Create a directory (I put mine in D:CodeNCC2012).  You want to issue the command:
o init-wrap <Name Of Project>
In the end, it will look something like this:

Init-wrap

You have now created the project in OpenWrap.  That is, you’ve set up a folder to contain the “wraps” or packages that will be used in your project.

Create the Site

[EDIT: Before you can run this command you need to do o add-wrap openrasta-templates to add the wrap to your project]

OpenWrap has a nice template built in for OpenRasta.  You can issue the command:

o new-openrastasite -Name <SolutionName> -Namespace <BaseNamespace>

Newopenrastasite

I chose to use PaymentService as my solution Name, and PaymentService.Api as my base Namespace in the example above.

Launch Studio

At this point, you’re really done.  The following screen shot shows that it created PaymentService.sln as well as my first project PaymentService.Api.  I simply executed

..src>PaymentService.sln & to launch my solution in to Studio (but you could actually load it any way you want.)

Showsolutioncreated

[EDIT: Or as Sebastian points out in the comments, add a -starteditor to the o new-openrastasite command and it will launch the editor for you — Thanks Sebastian]

Once this loads, you can hit F5 to run it, and you should be greeted with the default “Hello World” in XML.  From here on out, it’s just writing you’re service.

 


1 thought on “How to get an OpenRasta up and running”

  • 1
    serialseb on March 5, 2012 Reply

    Or you could use the -starteditor in creating the command 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *