# chopstick.ts

> A Typescript first web framework running on [Bun](https://bun.sh)

Latest version **0.0.22** (published 2023-03-03) · ISC license · 0 weekly downloads

## Install

```sh
npm install chopstick.ts
pnpm add chopstick.ts
yarn add chopstick.ts
bun add chopstick.ts
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.22 |
| Published | 2023-03-03 |
| First published | 2022-07-12 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 247.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | github.com/sp90 |
| Maintainers | sp90 |

## Links

- npm: https://www.npmjs.com/package/chopstick.ts
- npm.io page: https://npm.io/package/chopstick.ts

## Dependencies (3)

- [helmet](https://npm.io/package/helmet.md) ^6.0.0
- [bun-types](https://npm.io/package/bun-types.md) ^0.2.2
- [path-to-regexp](https://npm.io/package/path-to-regexp.md) ^6.2.1

## Recent versions

- 0.0.22 (latest) — 2023-03-03
- 0.0.21 — 2023-03-03
- 0.0.20 — 2022-11-25
- 0.0.19 — 2022-08-29
- 0.0.18 — 2022-08-23
- 0.0.17 — 2022-08-23
- 0.0.16 — 2022-08-23
- 0.0.15 — 2022-08-22
- 0.0.14 — 2022-08-22
- 0.0.13 — 2022-08-22
- 0.0.12 — 2022-08-19
- 0.0.11 — 2022-08-19
- 0.0.10 — 2022-08-18
- 0.0.9 — 2022-07-23
- 0.0.8 — 2022-07-12
- … 7 more at https://npm.io/package/chopstick.ts/versions

## README

# <img src="https://github.com/sp90/chopstick.ts/blob/e71c2d3830cef14b0b1617328f07826bded1d892/misc/chopstick.svg" width="60px"></img> Chopstick.ts

A Typescript first web framework running on [Bun](https://bun.sh)

<br />
  
[![Chopstick.ts - build and test](https://github.com/sp90/chopstick.ts/actions/workflows/build-and-test.yml/badge.svg)](https://github.com/sp90/chopstick.ts/actions/workflows/build-and-test.yml) [![npm version](https://badge.fury.io/js/chopstick.ts.svg)](https://badge.fury.io/js/chopstick.ts)

## Table of content

- Getting started
- Method support state

<br />

### Getting started

Important to know is, this is not aiming to be a drop in replacement for express this aims to be a slim framework that works super will in the 🥟 bun ecosystem.

It is though very inspired by the express syntax so its easy to adopt, currently solo working on the project but are open to PR's - besides that documentation & unit tests are coming

I'm also working on my first application that is utilizing this package in production

```sh
# Install package
bun install chopstick.ts
```

```ts
// basic app called on
// localhost:3000/hello/1?hello=world&hello=anotherworld
import Chopstick from 'chopstick.ts'

const app = new Chopstick()

app.use('/hello', () => {
  console.log('hello middle')
})

app.get('/hello/:id', ({ query, params }, res) => {
  console.log('hello')

  console.log(params) // { id: "1" }
  console.log(query) // { hello: [ "world", "anotherworld" ] }

  return res.json({
    singleFound: true,
  })
})

app.listen()
```

<br />

### Method support state

| app.methods        | support |                             comment                              |
| ------------------ | :-----: | :--------------------------------------------------------------: |
| app.listen         |   ✅    |                                                                  |
| app.all            |   ✅    |                                                                  |
| app.get            |   ✅    |                                                                  |
| app.put            |   ✅    |                                                                  |
| app.post           |   ✅    |                                                                  |
| app.use            |   ✅    |                                                                  |
| app.delete         |   ✅    |                                                                  |
| app.error          |   ✅    |                put at the end to catch all errors                |
| app.cors           |   ✅    | this works similar as the NPM-cors package for express extension |
| app.defaultHeaders |   ✅    |         Override the default headers in the application          |

| res.methods    | support |                          comment                          |
| -------------- | :-----: | :-------------------------------------------------------: |
| res.status     |   ✅    |                                                           |
| res.text       |   ✅    |                                                           |
| res.json       |   ✅    |                                                           |
| res.end        |   ✅    |                                                           |
| res.setHeader  |   ✅    | This will override a single header for this one response  |
| res.setHeaders |   ✅    | This will override multiple headers for this one response |

### Default headers

The base headers are the same base headers that are represented in NPM-helmet

| header                            | default header value                                                                                                                                                                                                                                                                |
| --------------------------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Content-Security-Policy           | default-src 'self';base-uri 'self';block-all-mixed-content;font-src 'self' https: data:;form-action 'self';frame-ancestors 'self';img-src 'self' data:;object-src 'none';script-src 'self';script-src-attr 'none';style-src 'self' https: 'unsafe-inline';upgrade-insecure-requests |
| Cross-Origin-Embedder-Policy      | require-corp                                                                                                                                                                                                                                                                        |
| Cross-Origin-Opener-Policy        | same-origin                                                                                                                                                                                                                                                                         |
| Cross-Origin-Resource-Policy      | same-origin                                                                                                                                                                                                                                                                         |
| Expect-CT                         | max-age=0                                                                                                                                                                                                                                                                           |
| Origin-Agent-Cluster              | ?1                                                                                                                                                                                                                                                                                  |
| Referrer-Policy                   | no-referrer                                                                                                                                                                                                                                                                         |
| Strict-Transport-Security         | max-age=15552000; includeSubDomains                                                                                                                                                                                                                                                 |
| X-Content-Type-Options            | nosniff                                                                                                                                                                                                                                                                             |
| X-DNS-Prefetch-Control            | off                                                                                                                                                                                                                                                                                 |
| X-Download-Options                | noopen                                                                                                                                                                                                                                                                              |
| X-Frame-Options                   | SAMEORIGIN                                                                                                                                                                                                                                                                          |
| X-Permitted-Cross-Domain-Policies | none                                                                                                                                                                                                                                                                                |
| X-XSS-Protection                  | 0                                                                                                                                                                                                                                                                                   |

---
_Source: https://npm.io/package/chopstick.ts · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
