BackendStack21 / 0http

Zero friction HTTP requests router. The need for speed!
https://0http.21no.de
MIT License
158 stars 11 forks source link

This expression is not callable error when initializing router and server #34

Closed not-ivy closed 1 year ago

not-ivy commented 1 year ago

Describe the bug
This expression is not callable. error when using 0http.

To Reproduce

import cero from '0http';
const { router, server } = cero();
server.listen(3000);

Expected behavior cero should be able to be called and the router and server should be able to be used.

Additional context
0http version: 3.5.1 typescript version: 5.0.4

jkyberneees commented 1 year ago

Hi @not-ivy , please find out a complete example below:

import zero from '0http'
import { Protocol } from '0http/common'

const { router, server } = zero<Protocol.HTTP>()

router.use((req, res, next) => {
  return next()
})

router.get('/hi', (req, res) => {
  res.end(`Hello World from TS!`)
})

server.listen(3000)