Skip to content

Commit

Permalink
Updating instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
paulie committed Sep 16, 2015
1 parent 17887c0 commit 460b7da
Showing 1 changed file with 33 additions and 1 deletion.
34 changes: 33 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,39 @@ curl http://localhost:8081/api/foo

## How to add an endpoint

**Quick way**:

Edit `mylibs/resources/mock.py` and add a rest class.
The class should contain at least the get method.
If you class is called `MyClass`, it will be reachable
at the `api/myclass` address of the web server.
at the `api/myclass` address of the web server.

You can specify a different address overiding the attribute `endpoint` inside
the class.

**Cleaner way**:

Define a file `confs/endpoints.ini` with the following syntax:

```
[module_name]
class=endpoint
```

For example, after creating a file `myresource.py` inside `mylibs/resources`,
containing two classes `One` and `Two`, you could use:

```
[myresource]
One=foo
Two=hello/world
```

The system would provide the two following working URLs:

```
# Resource One
http://localhost:8081/api/foo
# Resource Two
http://localhost:8081/api/hello/world
```

0 comments on commit 460b7da

Please sign in to comment.