File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -29,21 +29,18 @@ yarn add @secjs/http
2929
3030## Usage
3131
32- ### Sec
32+ ### SecJS
3333
34- > Use Sec to create the Http server and map all your routes with handlers
34+ > Use SecJS to create the Http server and map all your routes with handlers
3535
3636``` ts
37- import { Sec , Context } from ' @secjs/http'
37+ import { SecJS } from ' @secjs/http'
38+ import { SecContextContract } from ' @secjs/contracts'
3839
39- const server = new Sec ()
40+ const server = new SecJS ()
4041
41- server .get (' /' , (ctx : Context ) => {
42- ctx .response .writeHead (200 , { ' Content-Type' : ' application/json' })
43-
44- ctx .response .write (JSON .stringify ({ hello: ' world!' }))
45-
46- ctx .response .end ()
42+ server .get (' /' , (ctx : SecContextContract ) => {
43+ ctx .response .status (200 ).json ({ hello: ' world!' })
4744})
4845
4946server .listen (4040 , () => console .log (' Server running!' ))
You can’t perform that action at this time.
0 commit comments