Basics

Structure

Basic (and default) project structure looks like:

config.py
resources/
    resoruce_first.py
    resoruce_second.py
    ...

Then you can run the app with:

CFG=config.py uwsgi --module CodernityREST.creator --http 3007

Hints

  1. To start you need a directory with at least one resource file. It’s normal python file just named resource_{anything_you_wish}.
  2. CodernityREST will automatically import all files from that dir that follows that naming.
  3. On collecting phase, get_routes function from that file will be called. It has to return:
    • single ResourceRouter,
    • list of ResourceRouter,
    • None.
  4. By default application/json is the format of choice, input and output will be aromatically loaded and dumped. msgpack and xml are easily supported too. (example in tests)
  5. Please remember that even query string parameters has to be encoded in given format (defaults to application/json)