Skip to content

Latest commit

 

History

11 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This dll takes some of the pain away from registering routes in OpenRasta.
It's on Nuget as "OpenRasta.Routing"

So instead of registering routes like this :

  using (OpenRastaConfiguration.Manual)
  {

    ResourceSpace.Has.ResourcesOfType<object>()
      .AtUri("/foo/{id}").Named("view-foo")
      .HandledBy<FooHandler>()
      .AsJsonDataContract()
      .And.AsXmlDataContract();
  }

You can just call :

  using (OpenRastaConfiguration.Manual)
	{
		// Register all handler's routes in given assembly(s), and all model/wire types in given assembly(s)
		Routing.Register(typeof(FooHandler).Assembly, typeof(Foo).Assembly);
	}

And then tag your handlers : 

    public class FooHandler 
    {
        [Get("/foo/{id}")]
        public OperationResult Foo()
        {
            return new OperationResult.OK
            {
                ResponseResource = new Foo()
            };
        }

There are attributes for Get, Post, Put, Patch and Delete

About

Register routes with OpenRasta using attributes on your handlers, instead of manually via OR configuration

Resources

Stars

2 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages