# ri > WEBrick::CGI

---
type: CommandReference
command: WEBrick::CGI
mode: ri
section: ""
source: ri
---

## Quick Reference

- `class MyCGI < WEBrick::CGI` — Define a custom CGI handler
- `MyCGI.new.start` — Start the CGI processing

## Name

A CGI library using WEBrick requests and responses.

## Synopsis

ruby
class MyCGI < WEBrick::CGI
  def do_GET(req, res)
    res.body = 'it worked!'
    res.status = 200
  end
end
MyCGI.new.start
## Options

### Constants

- `CGIError` — The CGI error exception class

### Class Methods

- `new` — Create a new CGI instance

### Instance Methods

- `[]` — (no description)
- `config` — (attr_reader)
- `logger` — (attr_reader)
- `service` — Process the CGI request
- `start` — Start the CGI interaction

### Attributes

- `config` — Configuration hash (attr_reader)
- `logger` — Logger instance (attr_reader)

## Examples

ruby
class MyCGI < WEBrick::CGI
  def do_GET(req, res)
    res.body = 'it worked!'
    res.status = 200
  end
end
MyCGI.new.start
