@@ -23,40 +23,32 @@ The intention behind this repository is to always maintain a `Http` package to a
2323
2424<img src =" .github/http.png " width =" 200px " align =" right " hspace =" 30px " vspace =" 100px " >
2525
26- ## WARN 🛑⚠️
27-
28- > This project is under ` development ` do not use it until releases v1.0.0.
29-
3026## Installation
3127
32- > To use the high potential from @secjs/http you need to install first this packages from SecJS,
33- > it keeps as dev dependency because one day @secjs/core will install everything once.
34-
35- ``` bash
36- npm install @secjs/contracts @secjs/utils
37- ```
38-
3928``` bash
4029npm install @secjs/http
4130```
4231
4332## Usage
4433
45- ### SecJS
34+ ### Http
4635
47- > Use SecJS to create the Http server and map all your routes with handlers
36+ > Use Http class to create the http server and map all your routes
4837
4938``` ts
50- import { SecJS } from ' @secjs/http'
51- import { SecContextContract } from ' @secjs/contracts'
39+ import { Http , ContextContract } from ' @secjs/http'
40+
41+ const server = new Http ()
5242
53- const server = new SecJS ( )
43+ server . use ( ctx => ctx . data . param = ' param ' )
5444
55- server .get (' /' , (ctx : SecContextContract ) => {
56- ctx .response .status (200 ).json ({ hello: ' world!' })
45+ server .get (' /' , ({ response }) => {
46+ response
47+ .status (200 )
48+ .send ({ hello: ' world!' , param: ctx .data .param })
5749})
5850
59- server .listen (4040 , () => console .log (' Server running!' ))
51+ server .listen (1335 , () => console .log (' Server running!' ))
6052```
6153
6254---
0 commit comments