Skip to content

Commit

Permalink
Restructured
Browse files Browse the repository at this point in the history
  • Loading branch information
Scott Offen committed Nov 12, 2014
1 parent b5ea9c7 commit 2679f5c
Showing 1 changed file with 27 additions and 30 deletions.
57 changes: 27 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,54 +1,52 @@
Grapevine REST/HTTP Server +Client
==================================
Grapevine 3.0
=============

![](https://raw.github.com/scottoffen/Grapevine/master/grapevine.png)

**Current Version: 2.8.3**
*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 provides a framework to quickly and easily embed both REST Clients and multithreaded REST/HTTP servers into your applications using the ubiquitous [HttpListener](http://msdn.microsoft.com/en-us/library/vstudio/system.net.httplistener(v=vs.100)) class. Grapevine makes it equally simple to produce or consume REST services and serve up static files.
![](https://raw.github.com/scottoffen/Grapevine/master/grapevine.png)

## Use Grapevine ##
>Grapevine is a .NET 4.0 class library for embedding REST/HTTP servers **and/or** clients inside any application.
>
>**Server** - Utilizing the ubiquitous [`HttpListener`](http://msdn.microsoft.com/en-us/library/vstudio/system.net.httplistener(v=vs.100)) class, Grapevine allows you to map HTTP Methods and URL patterns (using regular expressions) to specific methods.
>
>**Client** - Streamline connecting and communicating with REST servers using simple patterns and placeholders.
>
>*Version 3.0 is not backwards compatible with earlier versions.*
See the wiki for a [**Getting Started Guide**](https://github.com/scottoffen/Grapevine/wiki/Getting-Started-Guide) and [other usage examples](https://github.com/scottoffen/Grapevine/wiki).
## Use Case for Grapevine ##

### Install Grapevine via NuGet ###
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.

Grapevine is available to install via [NuGet](https://www.nuget.org/packages/Grapevine/):
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.

```
> Install-Package Grapevine
```
>If an application needs to scale or do load balancing, it would likely benefit from the features offered by an [enterprise service bus](http://en.wikipedia.org/wiki/Enterprise_service_bus) (ESB). While Grapevine would not likely be a good fit for an ESB, it can certainly facilitate communication with them!
## Use Case for Grapevine ##
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.

Like the [informal means of communication](http://en.wikipedia.org/wiki/Grapevine_(gossip)) its name alludes to, Grapevine is designed for use in applications for which being a REST or HTTP client or server is not the primary function or purpose of the application, but rather a secondary means of communicating with the application.

For example, a Widows Forms application or Windows Service would be the "primary" means of communication with an application, and having an object (or several) that extends Grapevine listening on a particular port would be your secondary means of communication - even if you plan on using Grapevine to expose the majority of your functionality.
## Features ##

Having the REST client in the same package means you can use a single package to 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 an conversation with it.
- Grapevine uses a non-blocking I/O model, so the server is always ready to respond to incoming requests.

## 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](http://msdn.microsoft.com/en-us/library/vstudio/system.net.httplistenercontext(v=vs.110).aspx) is passed to your route every time, and each resource has a reference to the server that spawned it.

- Flexible : Grapevine includes all you need for a REST client, REST server, and a simple HTTP server.
- Manage multiple REST servers simultaneously and easily with a `RESTCluster`. Scope your resources to one, many or all REST servers.

- Fast : Grapevine uses a non-blocking I/O model, so the server is always ready to respond to incoming requests.
- 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.

- Consistent : The [message context](http://msdn.microsoft.com/en-us/library/vstudio/system.net.httplistenercontext(v=vs.110).aspx) is passed to your route handler methods - you get all of the data all of the time so you can decide how best to respond.
- Embed REST clients to interact with remote RESTful APIs. Initiate exchanges as well as respond them.

- Spontaneous : Grapevine finds the routes defined in your class, no need to "register" new ones. You can add files to the `webroot` folder to be served on-the-fly - no need to restart the server. You can even write a custom route to shut down your server remotely!
- Write messages out to a common event log for your entire application using `EventLogger`. [`404 Not Found`](http://en.wikipedia.org/wiki/HTTP_404) and [`500 Internal Server Error`](http://en.wikipedia.org/wiki/List_of_HTTP_status_codes#5xx_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](http://www.iis.net/) or [Apache HTTP Server](http://httpd.apache.org/). Nor is it a full-featured application server (like [Tomcat](http://en.wikipedia.org/wiki/Apache_Tomcat)) or framework (like [Spring](http://en.wikipedia.org/wiki/Spring_Framework)). Instead, Grapevine aims to be embedded in your application, where using one of those would be impossible, or just plain overkill.
- Grapevine is **not** intended to be a drop-in replacement for [Microsoft IIS](http://www.iis.net/) or [Apache HTTP Server](http://httpd.apache.org/). Nor is it a full-featured application server (like [Tomcat](http://en.wikipedia.org/wiki/Apache_Tomcat)) or framework (like [Spring](http://en.wikipedia.org/wiki/Spring_Framework)). 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).

- A single instance of a class that extends [`RestServer`](https://github.com/scottoffen/Grapevine/blob/master/Grapevine/RestServer.cs) will only listen on one host/port combination (however, you may define the host using the wildcard (* the asterisk) to listen on all ports).

- You will likely be required to [open a port in your firewall](http://www.lmgtfy.com/?q=how+to+open+a+port+on+windows) for remote computers to be able to send requests to your application. Grapevine will not [automatically](http://msdn.microsoft.com/en-us/library/aa366418%28VS.85%29.aspx) do that for you. You might want to do that during the [installation of your application](http://www.codeproject.com/Articles/14906/Open-Windows-Firewall-During-Installation).

## Contact Me ##
I'd love to hear from anyone using Grapevine, if for no other reason than to know someone else is finding this package useful. [Email me](mailto:github@scottoffen.com), or, if you are having problems, [open an issue](https://github.com/scottoffen/Grapevine/issues).
I love to hear from people and companies using Grapevine, if for no other reason than to know someone else is finding this package useful. Please, [email me](mailto:github@scottoffen.com) with your feedback; or, if you are having problems, [open an issue](https://github.com/scottoffen/Grapevine/issues).

Thanks for checking out Grapevine!

Expand All @@ -57,7 +55,6 @@ Copyright 2014 Scott Offen

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at [apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0)

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, **WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND**, either express or implied. See the License for the specific language governing permissions and
limitations under the License.
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, **WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND**, either express or implied. See the License for the specific language governing permissions and limitations under the License.

"Grapes In Dark Blue Cloud" Icon courtesy of [aha-soft](http://www.aha-soft.com/free-icons/free-dark-blue-cloud-icons/).
"Grapes In Dark Blue Cloud" Icon courtesy of [aha-soft](http://www.aha-soft.com/free-icons/free-dark-blue-cloud-icons/).

0 comments on commit 2679f5c

Please sign in to comment.