@buntal/http 0.0.4 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +44 -8
- package/app/cookie.ts +1 -1
- package/app/request.ts +2 -2
- package/app/response.ts +3 -3
- package/index.ts +0 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,15 +1,51 @@
|
|
|
1
|
-
|
|
1
|
+
<section align="center">
|
|
2
|
+
<img align="top" src="https://media.tenor.com/yjOrdcOkLPUAAAAj/green-dot.gif" width="22px" height="22px" />
|
|
3
|
+
<span>Early Development Stage</span>
|
|
4
|
+
<section>
|
|
2
5
|
|
|
3
|
-
|
|
6
|
+
<br/>
|
|
4
7
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
+
<section>
|
|
9
|
+
<img src="https://github.com/mgilangjanuar/buntal/raw/main/banner.png" alt="Buntal JS"/>
|
|
10
|
+
</section>
|
|
11
|
+
|
|
12
|
+
<br/>
|
|
13
|
+
|
|
14
|
+
<section align="center">
|
|
15
|
+
<a href="https://buntaljs.org" target="_blank">
|
|
16
|
+
Website
|
|
17
|
+
</a>
|
|
18
|
+
<span> · </span>
|
|
19
|
+
<a href="https://buntaljs.org/docs" target="_blank">
|
|
20
|
+
Docs
|
|
21
|
+
</a>
|
|
22
|
+
<span> · </span>
|
|
23
|
+
<a href="https://github.com/sponsors/mgilangjanuar" target="_blank">
|
|
24
|
+
Sponsor ♥
|
|
25
|
+
</a>
|
|
26
|
+
</section>
|
|
27
|
+
|
|
28
|
+
<br/>
|
|
8
29
|
|
|
9
|
-
|
|
30
|
+
<section align="left" markdown="1">
|
|
31
|
+
<p>Ultra-lightweight type-safe modern full-stack web framework with TypeScript, React and Bun. Create HTTP servers and/or web apps without unnecessary bloatware.</p>
|
|
10
32
|
|
|
11
33
|
```bash
|
|
12
|
-
bun
|
|
34
|
+
bun create buntal my-app
|
|
13
35
|
```
|
|
14
36
|
|
|
15
|
-
|
|
37
|
+
## Features
|
|
38
|
+
|
|
39
|
+
- **Blazing Fast**: Built on Bun, the fastest JavaScript runtime.
|
|
40
|
+
- **HTTP Server**: Create type-safe HTTP servers with Bun's native HTTP server.
|
|
41
|
+
- **File-based Routing**: Define routes using file structure, similar to Next.js.
|
|
42
|
+
- **SSR**: Server-side rendering for dynamic content.
|
|
43
|
+
- **SPA**: Single Page Application support with Bun's bundler.
|
|
44
|
+
- More to come!
|
|
45
|
+
|
|
46
|
+
View more examples [here](/examples).
|
|
47
|
+
|
|
48
|
+
> [!WARNING]
|
|
49
|
+
> NEVER use Buntal JS in production! Unless you are a pufferfish 🐡
|
|
50
|
+
|
|
51
|
+
</section>
|
package/app/cookie.ts
CHANGED
package/app/request.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Cookie } from './cookie'
|
|
2
2
|
|
|
3
3
|
export class Req<P = Record<string, string>, T = unknown> extends Request {
|
|
4
4
|
public params: P = {} as P
|
|
@@ -6,6 +6,6 @@ export class Req<P = Record<string, string>, T = unknown> extends Request {
|
|
|
6
6
|
public context?: T
|
|
7
7
|
|
|
8
8
|
get cookies() {
|
|
9
|
-
return
|
|
9
|
+
return Cookie.getAll(this)
|
|
10
10
|
}
|
|
11
11
|
}
|
package/app/response.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { BodyInit } from 'bun'
|
|
2
|
-
import {
|
|
2
|
+
import { Cookie, type CookieOptions } from './cookie'
|
|
3
3
|
|
|
4
4
|
export class Res {
|
|
5
5
|
private options: {
|
|
@@ -59,9 +59,9 @@ export class Res {
|
|
|
59
59
|
|
|
60
60
|
cookie(name: string, value?: string | null, options?: CookieOptions) {
|
|
61
61
|
if (value) {
|
|
62
|
-
|
|
62
|
+
Cookie.set(this, name, value, options)
|
|
63
63
|
} else {
|
|
64
|
-
|
|
64
|
+
Cookie.delete(this, name)
|
|
65
65
|
}
|
|
66
66
|
return this
|
|
67
67
|
}
|
package/index.ts
CHANGED