Skip to content

Commit 79097df

Browse files
authored
Merge pull request #5 from SecJS/docs/len-update-readme
docs: Update README
2 parents 6891f6a + ad11831 commit 79097df

File tree

3 files changed

+10
-12
lines changed

3 files changed

+10
-12
lines changed

README.md

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -34,22 +34,17 @@ yarn add @secjs/http
3434
> Use Sec to create the Http server and map all your routes with handlers
3535
3636
```ts
37-
import { Sec } from '@secjs/http'
37+
import { Sec, Context } from '@secjs/http'
3838

3939
const server = new Sec()
4040

41-
server.get(
42-
'/users/:id/likes/:like_id',
43-
(request: IncomingMessage, response: ServerResponse) => {
44-
response.writeHead(200, { 'Content-Type': 'application/json' })
41+
server.get('/', (ctx: Context) => {
42+
ctx.response.writeHead(200, { 'Content-Type': 'application/json' })
4543

46-
response.write(
47-
JSON.stringify({ data: { id: 1, name: 'Like 1', userId: 1 } }),
48-
)
44+
ctx.response.write(JSON.stringify({ hello: 'world!' }))
4945

50-
response.end()
51-
},
52-
)
46+
ctx.response.end()
47+
})
5348

5449
server.listen(4040, () => console.log('Server running!'))
5550
```

index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
11
export * from './src/server'
2+
3+
export * from './src/Contracts/RouteContract'
4+
export * from './src/Contracts/HandlerContract'

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@secjs/http",
3-
"version": "0.0.4",
3+
"version": "0.0.5",
44
"description": "",
55
"scripts": {
66
"build": "tsc",

0 commit comments

Comments
 (0)