@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 CHANGED
@@ -1,15 +1,51 @@
1
- # @buntal/http
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
- To install dependencies:
6
+ <br/>
4
7
 
5
- ```bash
6
- bun install
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> &nbsp;&middot; &nbsp;</span>
19
+ <a href="https://buntaljs.org/docs" target="_blank">
20
+ Docs
21
+ </a>
22
+ <span> &nbsp;&middot; &nbsp;</span>
23
+ <a href="https://github.com/sponsors/mgilangjanuar" target="_blank">
24
+ Sponsor &hearts;
25
+ </a>
26
+ </section>
27
+
28
+ <br/>
8
29
 
9
- To run:
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 run index.ts
34
+ bun create buntal my-app
13
35
  ```
14
36
 
15
- This project was created using `bun init` in bun v1.2.16. [Bun](https://bun.sh) is a fast all-in-one JavaScript runtime.
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
@@ -11,7 +11,7 @@ export type CookieOptions = {
11
11
  sameSite?: 'Strict' | 'Lax' | 'None'
12
12
  }
13
13
 
14
- export const cookie = {
14
+ export const Cookie = {
15
15
  get: (req: Req, name: string) => {
16
16
  const cookies = req.headers.get('cookie')
17
17
  if (!cookies) return null
package/app/request.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { cookie } from './cookie'
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 cookie.getAll(this)
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 { cookie, type CookieOptions } from './cookie'
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
- cookie.set(this, name, value, options)
62
+ Cookie.set(this, name, value, options)
63
63
  } else {
64
- cookie.delete(this, name)
64
+ Cookie.delete(this, name)
65
65
  }
66
66
  return this
67
67
  }
package/index.ts CHANGED
@@ -181,7 +181,6 @@ export class Http {
181
181
  }
182
182
  }
183
183
 
184
-
185
184
  export * from './app'
186
185
  export * from './router'
187
186
  export * from './handler'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@buntal/http",
3
- "version": "0.0.4",
3
+ "version": "0.0.6",
4
4
  "module": "index.ts",
5
5
  "type": "module",
6
6
  "devDependencies": {