Grapevine is a .NET class library for embedding REST/HTTP servers and/or clients inside any application. Grapevine allows you to map HTTP Methods and URL patterns (using regular expressions) to specific methods and streamlines connecting and communicating with REST servers using simple patterns and placeholders.
Grapevine is a .NET class library for embedding REST/HTTP servers and/or clients inside any application. Grapevine allows you to map HTTP Methods and URL patterns (using regular expressions) to specific methods and streamlines connecting and communicating with REST servers using simple patterns and placeholders.
- 4.1.1 - Latest stable version on NuGet
Primary Use Case
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.
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
and500 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.