Skip to content

Commit 84a7e13

Browse files
committed
docs: Update docs
1 parent 99cdefd commit 84a7e13

1 file changed

Lines changed: 7 additions & 10 deletions

File tree

README.md

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff 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

4946
server.listen(4040, () => console.log('Server running!'))

0 commit comments

Comments
 (0)