Skip to content

Because embedding a REST server in your application should be simple.

License

Notifications You must be signed in to change notification settings

Beluk/Grapevine

 
 

Repository files navigation

Grapevine 3.0.4

Nuget GitHub license GitHub issues Percentage of issues still open Average time to resolve an issue

The best solutions are the simplest to implement. Embedding a REST/HTTP server in your application should be simple. Consuming REST resources from inside your application should be simple. If what you've been using doesn't feel simple, try Grapevine. It doesn't get any simpler than this.

Grapevine is a .NET 4.0 class library for embedding REST/HTTP servers and/or clients inside any application. Utilizing the ubiquitous HttpListener class, Grapevine allows you to map HTTP Methods and URL patterns (using regular expressions) to specific methods. It also streamlines connecting and communicating with REST servers using simple patterns and placeholders.

Version 3.0 is not backwards compatible with earlier versions. For a version of Grapevine with JSON support baked in, try new Grapevine Plus!

Use Case for Grapevine

Grapevine is designed for use in an application for which being a REST or HTTP client or server is not the primary function or purpose of the application, but rather a standardized means of communication with the application.

For example, a Widows Forms application or Windows Service would be the "primary" means of communication with an application, and having a Grapevine RESTServer (or several) listening on a particular protocol/host/port combination would be a secondary means of communication - even if Grapevine is used to expose the majority of the functionality.

If an application needs to scale or do load balancing, it would likely benefit from the features offered by an enterprise service bus (ESB). While Grapevine would not likely be a good fit for an ESB, it can certainly facilitate communication with them!

Having a REST client in the same package means you can both produce and consume REST services - such as building an application that actively communicates with other applications like it on the network by initiating the conversation, not just waiting around to for something else to initiate a conversation with it.

Features

  • Embed a REST server in your application. Add attributes to your classes and methods to define resources and routes for managing traffic based on HTTP method and path info (using regular expressions). The message context is passed to your route every time, and each resource has a reference to the server that spawned it.

  • Manage multiple REST servers simultaneously and easily with a RESTCluster. Scope your resources to one, many or all REST servers.

  • Serve up static files (HTML, CSS, JavaScript, images, etc.) with virtually no configuration. Each server can have a unique location to serve files from, or they can all share a location.

  • Embed REST clients to interact with remote RESTful APIs. Initiate exchanges as well as respond them.

  • Write messages out to a common event log for your entire application using EventLogger. 404 Not Found and 500 Internal Server Error responses are handled automatically if a route or file cannot be found or throws an unhandled exception, respectively. Have complete control over the response returned to the client.

Limitations

  • Grapevine is not intended to be a drop-in replacement for Microsoft IIS or Apache HTTP Server. Nor is it a full-featured application server (like Tomcat) or framework (like Spring). Instead, Grapevine aims to be embedded in your application, where using one of those would be impossible, or just plain overkill.

  • Grapevine does not do any script parsing (PHP, Perl, Python, Ruby, etc.) by default - but feel free to fork this project and hack away! I'm pretty sure it could be done, I just haven't encountered a need for it (yet).

  • You will likely be required to open a port in your firewall for remote computers to be able to send requests to your application. Grapevine will not automatically do that for you. You might want to do that during the installation of your application.

Contact Me

Feel free to contact me with feedback if Grapevine has been useful for you or your company. If you find you are having problems and need help check out my support options.

"Grapes In Dark Blue Cloud" Icon courtesy of aha-soft.

About

Because embedding a REST server in your application should be simple.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C# 100.0%