0.0.22 • Published 1 year ago

chopstick.ts v0.0.22

Weekly downloads
-
License
ISC
Repository
-
Last release
1 year ago

Chopstick.ts

A Typescript first web framework running on Bun

Table of content

  • Getting started
  • Method support state

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

# Install package
bun install chopstick.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()

Method support state

app.methodssupportcomment
app.listen
app.all
app.get
app.put
app.post
app.use
app.delete
app.errorput at the end to catch all errors
app.corsthis works similar as the NPM-cors package for express extension
app.defaultHeadersOverride the default headers in the application
res.methodssupportcomment
res.status
res.text
res.json
res.end
res.setHeaderThis will override a single header for this one response
res.setHeadersThis will override multiple headers for this one response

Default headers

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

headerdefault header value
Content-Security-Policydefault-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-Policyrequire-corp
Cross-Origin-Opener-Policysame-origin
Cross-Origin-Resource-Policysame-origin
Expect-CTmax-age=0
Origin-Agent-Cluster?1
Referrer-Policyno-referrer
Strict-Transport-Securitymax-age=15552000; includeSubDomains
X-Content-Type-Optionsnosniff
X-DNS-Prefetch-Controloff
X-Download-Optionsnoopen
X-Frame-OptionsSAMEORIGIN
X-Permitted-Cross-Domain-Policiesnone
X-XSS-Protection0
0.0.21

1 year ago

0.0.22

1 year ago

0.0.20

1 year ago

0.0.19

2 years ago

0.0.18

2 years ago

0.0.17

2 years ago

0.0.16

2 years ago

0.0.15

2 years ago

0.0.14

2 years ago

0.0.13

2 years ago

0.0.12

2 years ago

0.0.11

2 years ago

0.0.10

2 years ago

0.0.9

2 years ago

0.0.8

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago