Skip to content

Commit c19bb30

Browse files
author
Edvard Majakari
committed
Markdown fixes, ignore .vscode dir
- Fix some Markdown issues - Ignore VSCode files
1 parent 7929150 commit c19bb30

File tree

2 files changed

+7
-12
lines changed

2 files changed

+7
-12
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,3 +73,6 @@ venv/
7373

7474
# Emacs backup
7575
*~
76+
77+
# VSCode
78+
/.vscode

README.md

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ As a result of these goals, hug is Python 3+ only and built upon [Falcon's](http
2525

2626
[![HUG Hello World Example](https://raw.github.com/hugapi/hug/develop/artwork/example.gif)](https://github.com/hugapi/hug/blob/develop/examples/hello_world.py)
2727

28-
2928
Installing hug
3029
===================
3130

@@ -37,9 +36,9 @@ pip3 install hug --upgrade
3736

3837
Ideally, within a [virtual environment](http://docs.python-guide.org/en/latest/dev/virtualenvs/).
3938

40-
4139
Getting Started
4240
===================
41+
4342
Build an example API with a simple endpoint in just a few lines.
4443

4544
```py
@@ -118,7 +117,6 @@ Then you can access the example from `localhost:8000/v1/echo?text=Hi` / `localho
118117

119118
Note: versioning in hug automatically supports both the version header as well as direct URL based specification.
120119

121-
122120
Testing hug APIs
123121
===================
124122

@@ -141,7 +139,6 @@ def tests_happy_birthday():
141139
assert response.data is not None
142140
```
143141

144-
145142
Running hug with other WSGI based servers
146143
===================
147144

@@ -155,7 +152,6 @@ uwsgi --http 0.0.0.0:8000 --wsgi-file examples/hello_world.py --callable __hug_w
155152

156153
To run the hello world hug example API.
157154

158-
159155
Building Blocks of a hug API
160156
===================
161157

@@ -182,7 +178,6 @@ def math(number_1:int, number_2:int): #The :int after both arguments is the Type
182178
Type annotations also feed into `hug`'s automatic documentation
183179
generation to let users of your API know what data to supply.
184180

185-
186181
**Directives** functions that get executed with the request / response data based on being requested as an argument in your api_function.
187182
These apply as input parameters only, and can not be applied currently as output formats or transformations.
188183

@@ -242,7 +237,6 @@ def hello():
242237

243238
as shown, you can easily change the output format for both an entire API as well as an individual API call
244239

245-
246240
**Input Formatters** a function that takes the body of data given from a user of your API and formats it for handling.
247241

248242
```py
@@ -253,7 +247,6 @@ def my_input_formatter(data):
253247

254248
Input formatters are mapped based on the `content_type` of the request data, and only perform basic parsing. More detailed parsing should be done by the Type Annotations present on your `api_function`
255249

256-
257250
**Middleware** functions that get called for every request a hug API processes
258251

259252
```py
@@ -314,7 +307,6 @@ Or alternatively - for cases like this - where only one module is being included
314307
hug.API(__name__).extend(something, '/something')
315308
```
316309

317-
318310
Configuring hug 404
319311
===================
320312

@@ -346,14 +338,14 @@ def not_found_handler():
346338
return "Not Found"
347339
```
348340

349-
350341
Asyncio support
351342
===============
352343

353344
When using the `get` and `cli` method decorator on coroutines, hug will schedule
354345
the execution of the coroutine.
355346

356347
Using asyncio coroutine decorator
348+
357349
```py
358350
@hug.get()
359351
@asyncio.coroutine
@@ -362,6 +354,7 @@ def hello_world():
362354
```
363355

364356
Using Python 3.5 async keyword.
357+
365358
```py
366359
@hug.get()
367360
async def hello_world():
@@ -371,9 +364,9 @@ async def hello_world():
371364
NOTE: Hug is running on top Falcon which is not an asynchronous server. Even if using
372365
asyncio, requests will still be processed synchronously.
373366

374-
375367
Using Docker
376368
===================
369+
377370
If you like to develop in Docker and keep your system clean, you can do that but you'll need to first install [Docker Compose](https://docs.docker.com/compose/install/).
378371

379372
Once you've done that, you'll need to `cd` into the `docker` directory and run the web server (Gunicorn) specified in `./docker/gunicorn/Dockerfile`, after which you can preview the output of your API in the browser on your host machine.
@@ -413,7 +406,6 @@ bash-4.3# tree
413406
1 directory, 3 files
414407
```
415408

416-
417409
Why hug?
418410
===================
419411

0 commit comments

Comments
 (0)