This repository was archived by the owner on Aug 24, 2023. It is now read-only.
- Notifications
You must be signed in to change notification settings - Fork9
GServ: Framework for SPAs and REST based services.
License
NotificationsYou must be signed in to change notification settings
javaConductor/gserv
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
gServ is a tool for creating and deploying REST based services using Groovy without the hassle of a container (JBoss, Tomcat, etc.) . Using gServ, you can easily define REST resources as Groovy scripts or embed gServ in your application. gServ is perfect for creating lightweight micro services.
gServ can be used in two ways <br/><h3>Features:</h3> <ul> <li>Container Free <li>Serve static files <li>Serve Groovy script as REST resources <li><a href="https://github.com/javaConductor/gserv/wiki/gServ-HATEOAS"> HATEOAS Support</a> <li>Easy Content Negotiation <li>Plugin API <li><a href="https://github.com/javaConductor/gserv/wiki/gServ-Framework">Embeddable</a> <li><a href="https://github.com/javaConductor/gserv/wiki/gServ-Standalone">Standalone Mode</a> <li>CORS support <li>Compression support <li>ETag support <li>Basic Authentication <li> HTTPS </ul> <h3>Requirements:</h3> <ul><li>Java JDK 1.6+</li> <li>Groovy 2.3+ (Framework only)</li> </ul><div> <h3>Basic Concepts</h3> <table width="90%"> <tr><th>Term</th> <th>Meaning</th></tr> <tr><td>Action</td> <td>HTTP request handler for a particular path/query/method combination. </td></tr> <tr><td>Resources</td> <td>Resources define actions for a particular root path (eg. /books) and its sub-resources (eg. /books/bestSellers). </td></tr> <tr><td>Server Config</td><td>The config encapsulates any resources, actions, filters, and plugins. </td></tr> <tr><td>Server Instance</td><td>This is the actual server instance that will listen to the specified port and handle requests based on its configuration.</td></tr> </table></div>
[Framework](https://github.com/javaConductor/gserv/wiki/gServ-Framework)
[Standalone](https://github.com/javaConductor/gserv/wiki/gServ-Standalone)#Simple Examples
Creating REST Resources | |
---|---|
| |
The root path is passed to the GServ.resource() method along with a closure defining the actions for the resource. | |
Creating a Server Instance | |
| |
The http() method creates a GServInstance that can later listen on a port and handle HTTP requests. This server instancedefines static roots usually used for templates for single-page apps and a single FAQ page.Then, after the server instance is returned from the http() method, we can immediately call start(8080) on it. | |
Adding Resources to a Server Instance | |
| |
A server instance can be created by simply adding resources. Here we add our 2 resources: bkResources anduserResources. Now, all URIs related to both resources are available once the instance is started. This instance alsodefines a static_root which tells gserv where to find static files such as the FAQ page which should be at /public/webapp/App.faq.html. |
About
GServ: Framework for SPAs and REST based services.
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
No packages published
Uh oh!
There was an error while loading.Please reload this page.