File: api.py

package info (click to toggle)
python-hug 2.6.0-2.4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 4,072 kB
  • sloc: python: 8,938; sh: 99; makefile: 17
file content (20 lines) | stat: -rw-r--r-- 384 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import hug
import part_1
import part_2


@hug.get("/")
def say_hi():
    """This view will be at the path ``/``"""
    return "Hi from root"


@hug.extend_api()
def with_other_apis():
    """Join API endpoints from two other modules

    These will be at ``/part1`` and ``/part2``, the paths being automatically
    generated from function names.

    """
    return [part_1, part_2]