Skip to content

Commit

Permalink
updates: reduce bundle size&integrate [email protected]
Browse files Browse the repository at this point in the history
  • Loading branch information
abschill committed Jun 17, 2022
1 parent 1c77fbb commit 7fbe8ea
Show file tree
Hide file tree
Showing 16 changed files with 349 additions and 980 deletions.
4 changes: 0 additions & 4 deletions __fixtures__/http.puppy

This file was deleted.

7 changes: 3 additions & 4 deletions __fixtures__/httpuppy.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
config:
port: 3000
static:
path: examples/files
port: 3000
static:
path: examples/files
2 changes: 1 addition & 1 deletion bin/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#! /usr/bin/env node
const { useCLIConfigFinder } = require('../lib/internal/config/argv.js');
const { useCLIConfigFinder } = require('../lib/internal/config');
const { useColorTag } = require('../lib/internal/include');
const { useServer } = require('../lib');
const cluster = require('cluster');
Expand Down
14 changes: 1 addition & 13 deletions docs/reference/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,4 @@ clustered mode will allow your server to utilize multiple cores available on you
you can set a custom path for the config file by adding argument in the format `npx httpuppy <config_path>`


### json/yml configuration

you can also configure your file to be in json/yml, which directly maps to the config structure, and needs no sort of mental difference in mapping. When you run `npx httpuppy` you will be greeted with a menu that gives you a list of options of valid config files that it detected, so just choose the one you want. these 2 have a more direct mapping to the structure so its probably the best to use them.

[json example](httpuppy.json)
[yaml example](/__fixtures__/httpuppy.yml)

### ini config

config parser follows .ini format, so you can add key value pairs as such to organize your properties. The important one for now is the `config` key, which roughly maps to your [`HTTPuppyServerOptions`](https://github.com/abschill/httpuppy/blob/main/docs/interfaces/types_server.HTTPuppyServerOptions.md) configuration object if you are using the library itself.


In the [base](https://github.com/abschill/httpuppy/blob/main/__fixtures__/http.puppy) of the repository you will find an example configuration, the alternative being inline flags that map to the correct keys when stripped of their prefixed `--`. The exception is the static option `path` is just aliased to the top level of the file-based config.
file config options support json, yaml, and toml.
2 changes: 1 addition & 1 deletion docs/typedoc/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
httpuppy - v0.3.13 / [Modules](modules.md)
httpuppy - v0.3.14 / [Modules](modules.md)

# HTTPuppy

Expand Down
8 changes: 4 additions & 4 deletions docs/typedoc/interfaces/useServer.HTTPuppyRequest.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[httpuppy - v0.3.13](../README.md) / [Modules](../modules.md) / [useServer](../modules/useServer.md) / HTTPuppyRequest
[httpuppy - v0.3.14](../README.md) / [Modules](../modules.md) / [useServer](../modules/useServer.md) / HTTPuppyRequest

# Interface: HTTPuppyRequest

Expand Down Expand Up @@ -85,7 +85,7 @@

#### Defined in

[src/server.ts:54](https://github.com/abschill/httpuppy/blob/60143b3/src/server.ts#L54)
[src/server.ts:54](https://github.com/abschill/httpuppy/blob/1c77fbb/src/server.ts#L54)

___

Expand All @@ -95,7 +95,7 @@ ___

#### Defined in

[src/server.ts:55](https://github.com/abschill/httpuppy/blob/60143b3/src/server.ts#L55)
[src/server.ts:55](https://github.com/abschill/httpuppy/blob/1c77fbb/src/server.ts#L55)

___

Expand Down Expand Up @@ -126,7 +126,7 @@ ___

#### Defined in

[src/server.ts:53](https://github.com/abschill/httpuppy/blob/60143b3/src/server.ts#L53)
[src/server.ts:53](https://github.com/abschill/httpuppy/blob/1c77fbb/src/server.ts#L53)

___

Expand Down
8 changes: 4 additions & 4 deletions docs/typedoc/interfaces/useServer.HTTPuppyResponse.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[httpuppy - v0.3.13](../README.md) / [Modules](../modules.md) / [useServer](../modules/useServer.md) / HTTPuppyResponse
[httpuppy - v0.3.14](../README.md) / [Modules](../modules.md) / [useServer](../modules/useServer.md) / HTTPuppyResponse

# Interface: HTTPuppyResponse

Expand Down Expand Up @@ -89,7 +89,7 @@

#### Defined in

[src/server.ts:58](https://github.com/abschill/httpuppy/blob/60143b3/src/server.ts#L58)
[src/server.ts:58](https://github.com/abschill/httpuppy/blob/1c77fbb/src/server.ts#L58)

___

Expand Down Expand Up @@ -1352,7 +1352,7 @@ ___

#### Defined in

[src/server.ts:60](https://github.com/abschill/httpuppy/blob/60143b3/src/server.ts#L60)
[src/server.ts:60](https://github.com/abschill/httpuppy/blob/1c77fbb/src/server.ts#L60)

___

Expand Down Expand Up @@ -2371,7 +2371,7 @@ ___

#### Defined in

[src/server.ts:59](https://github.com/abschill/httpuppy/blob/60143b3/src/server.ts#L59)
[src/server.ts:59](https://github.com/abschill/httpuppy/blob/1c77fbb/src/server.ts#L59)

___

Expand Down
16 changes: 8 additions & 8 deletions docs/typedoc/interfaces/useServer.HTTPuppyServer.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[httpuppy - v0.3.13](../README.md) / [Modules](../modules.md) / [useServer](../modules/useServer.md) / HTTPuppyServer
[httpuppy - v0.3.14](../README.md) / [Modules](../modules.md) / [useServer](../modules/useServer.md) / HTTPuppyServer

# Interface: HTTPuppyServer

Expand Down Expand Up @@ -68,7 +68,7 @@

#### Defined in

[src/server.ts:50](https://github.com/abschill/httpuppy/blob/60143b3/src/server.ts#L50)
[src/server.ts:50](https://github.com/abschill/httpuppy/blob/1c77fbb/src/server.ts#L50)

___

Expand All @@ -78,7 +78,7 @@ ___

#### Defined in

[src/server.ts:49](https://github.com/abschill/httpuppy/blob/60143b3/src/server.ts#L49)
[src/server.ts:49](https://github.com/abschill/httpuppy/blob/1c77fbb/src/server.ts#L49)

___

Expand All @@ -102,7 +102,7 @@ ___

#### Defined in

[src/server.ts:45](https://github.com/abschill/httpuppy/blob/60143b3/src/server.ts#L45)
[src/server.ts:45](https://github.com/abschill/httpuppy/blob/1c77fbb/src/server.ts#L45)

___

Expand Down Expand Up @@ -252,7 +252,7 @@ ___

#### Defined in

[src/server.ts:46](https://github.com/abschill/httpuppy/blob/60143b3/src/server.ts#L46)
[src/server.ts:46](https://github.com/abschill/httpuppy/blob/1c77fbb/src/server.ts#L46)

___

Expand All @@ -262,7 +262,7 @@ ___

#### Defined in

[src/server.ts:44](https://github.com/abschill/httpuppy/blob/60143b3/src/server.ts#L44)
[src/server.ts:44](https://github.com/abschill/httpuppy/blob/1c77fbb/src/server.ts#L44)

___

Expand Down Expand Up @@ -2546,7 +2546,7 @@ ___

#### Defined in

[src/server.ts:47](https://github.com/abschill/httpuppy/blob/60143b3/src/server.ts#L47)
[src/server.ts:47](https://github.com/abschill/httpuppy/blob/1c77fbb/src/server.ts#L47)

___

Expand All @@ -2560,7 +2560,7 @@ ___

#### Defined in

[src/server.ts:48](https://github.com/abschill/httpuppy/blob/60143b3/src/server.ts#L48)
[src/server.ts:48](https://github.com/abschill/httpuppy/blob/1c77fbb/src/server.ts#L48)

___

Expand Down
32 changes: 16 additions & 16 deletions docs/typedoc/interfaces/useServer.HTTPuppyServerOptions.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[httpuppy - v0.3.13](../README.md) / [Modules](../modules.md) / [useServer](../modules/useServer.md) / HTTPuppyServerOptions
[httpuppy - v0.3.14](../README.md) / [Modules](../modules.md) / [useServer](../modules/useServer.md) / HTTPuppyServerOptions

# Interface: HTTPuppyServerOptions

Expand Down Expand Up @@ -60,7 +60,7 @@

#### Defined in

[src/server.ts:105](https://github.com/abschill/httpuppy/blob/60143b3/src/server.ts#L105)
[src/server.ts:105](https://github.com/abschill/httpuppy/blob/1c77fbb/src/server.ts#L105)

___

Expand All @@ -70,7 +70,7 @@ ___

#### Defined in

[src/server.ts:97](https://github.com/abschill/httpuppy/blob/60143b3/src/server.ts#L97)
[src/server.ts:97](https://github.com/abschill/httpuppy/blob/1c77fbb/src/server.ts#L97)

___

Expand All @@ -80,7 +80,7 @@ ___

#### Defined in

[src/server.ts:106](https://github.com/abschill/httpuppy/blob/60143b3/src/server.ts#L106)
[src/server.ts:106](https://github.com/abschill/httpuppy/blob/1c77fbb/src/server.ts#L106)

___

Expand All @@ -90,7 +90,7 @@ ___

#### Defined in

[src/server.ts:98](https://github.com/abschill/httpuppy/blob/60143b3/src/server.ts#L98)
[src/server.ts:98](https://github.com/abschill/httpuppy/blob/1c77fbb/src/server.ts#L98)

___

Expand All @@ -100,7 +100,7 @@ ___

#### Defined in

[src/server.ts:101](https://github.com/abschill/httpuppy/blob/60143b3/src/server.ts#L101)
[src/server.ts:101](https://github.com/abschill/httpuppy/blob/1c77fbb/src/server.ts#L101)

___

Expand All @@ -110,7 +110,7 @@ ___

#### Defined in

[src/server.ts:102](https://github.com/abschill/httpuppy/blob/60143b3/src/server.ts#L102)
[src/server.ts:102](https://github.com/abschill/httpuppy/blob/1c77fbb/src/server.ts#L102)

___

Expand All @@ -120,7 +120,7 @@ ___

#### Defined in

[src/server.ts:104](https://github.com/abschill/httpuppy/blob/60143b3/src/server.ts#L104)
[src/server.ts:104](https://github.com/abschill/httpuppy/blob/1c77fbb/src/server.ts#L104)

___

Expand All @@ -130,7 +130,7 @@ ___

#### Defined in

[src/server.ts:103](https://github.com/abschill/httpuppy/blob/60143b3/src/server.ts#L103)
[src/server.ts:103](https://github.com/abschill/httpuppy/blob/1c77fbb/src/server.ts#L103)

___

Expand All @@ -140,7 +140,7 @@ ___

#### Defined in

[src/server.ts:96](https://github.com/abschill/httpuppy/blob/60143b3/src/server.ts#L96)
[src/server.ts:96](https://github.com/abschill/httpuppy/blob/1c77fbb/src/server.ts#L96)

___

Expand All @@ -150,7 +150,7 @@ ___

#### Defined in

[src/server.ts:107](https://github.com/abschill/httpuppy/blob/60143b3/src/server.ts#L107)
[src/server.ts:107](https://github.com/abschill/httpuppy/blob/1c77fbb/src/server.ts#L107)

___

Expand All @@ -168,7 +168,7 @@ ___

#### Defined in

[src/server.ts:108](https://github.com/abschill/httpuppy/blob/60143b3/src/server.ts#L108)
[src/server.ts:108](https://github.com/abschill/httpuppy/blob/1c77fbb/src/server.ts#L108)

___

Expand All @@ -178,7 +178,7 @@ ___

#### Defined in

[src/server.ts:99](https://github.com/abschill/httpuppy/blob/60143b3/src/server.ts#L99)
[src/server.ts:99](https://github.com/abschill/httpuppy/blob/1c77fbb/src/server.ts#L99)

___

Expand All @@ -188,7 +188,7 @@ ___

#### Defined in

[src/server.ts:100](https://github.com/abschill/httpuppy/blob/60143b3/src/server.ts#L100)
[src/server.ts:100](https://github.com/abschill/httpuppy/blob/1c77fbb/src/server.ts#L100)

___

Expand All @@ -198,7 +198,7 @@ ___

#### Defined in

[src/server.ts:113](https://github.com/abschill/httpuppy/blob/60143b3/src/server.ts#L113)
[src/server.ts:113](https://github.com/abschill/httpuppy/blob/1c77fbb/src/server.ts#L113)

___

Expand All @@ -208,4 +208,4 @@ ___

#### Defined in

[src/server.ts:114](https://github.com/abschill/httpuppy/blob/60143b3/src/server.ts#L114)
[src/server.ts:114](https://github.com/abschill/httpuppy/blob/1c77fbb/src/server.ts#L114)
4 changes: 2 additions & 2 deletions docs/typedoc/modules.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[httpuppy - v0.3.13](README.md) / Modules
[httpuppy - v0.3.14](README.md) / Modules

# httpuppy - v0.3.13
# httpuppy - v0.3.14

## Table of contents

Expand Down
6 changes: 3 additions & 3 deletions docs/typedoc/modules/useRouter.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[httpuppy - v0.3.13](../README.md) / [Modules](../modules.md) / useRouter
[httpuppy - v0.3.14](../README.md) / [Modules](../modules.md) / useRouter

# Module: useRouter

Expand Down Expand Up @@ -29,7 +29,7 @@

#### Defined in

[src/router.ts:52](https://github.com/abschill/httpuppy/blob/60143b3/src/router.ts#L52)
[src/router.ts:52](https://github.com/abschill/httpuppy/blob/1c77fbb/src/router.ts#L52)

## Functions

Expand Down Expand Up @@ -59,4 +59,4 @@ router.get('/test', (req, res) => res.end('hello'));

#### Defined in

[src/router.ts:123](https://github.com/abschill/httpuppy/blob/60143b3/src/router.ts#L123)
[src/router.ts:123](https://github.com/abschill/httpuppy/blob/1c77fbb/src/router.ts#L123)
Loading

0 comments on commit 7fbe8ea

Please sign in to comment.