Skip to content
This repository has been archived by the owner on Jun 10, 2020. It is now read-only.

Commit

Permalink
udpate document
Browse files Browse the repository at this point in the history
  • Loading branch information
vincent178 committed Mar 14, 2017
1 parent 35cea55 commit 2c5db3a
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@


> Initialize Application


```typescript
@ApplicationSettings({rootDir: `${__dirname}/../`})
class Application extends ApplicationLoader {
Expand Down Expand Up @@ -65,6 +68,9 @@ ApplicationSettings options:
```

> Handle a request


```typescript
@RestController()
export class HomeController {
Expand All @@ -89,7 +95,11 @@ All parameter types:
@Err
@Data
```

> Use a filter, pass data across filter and controller


```typescript
@Filter()
export class CurrentUser implements IMiddleware {
Expand Down Expand Up @@ -119,7 +129,8 @@ export class HomeController {
```

> Use global middleware
just define a class as a Middleware

```typescript
@Middleware({order: 0})
export class Middleware1 implements IMiddleware {
Expand All @@ -132,6 +143,8 @@ export class Middleware1 implements IMiddleware {
```

> Use global error middleware

```typescript
@ErrorMiddleware()
export class ErrMiddleware implements IMiddleware {
Expand All @@ -143,6 +156,9 @@ export class ErrMiddleware implements IMiddleware {
```

> Use a service and inject into controller and middleware, filter


```typescript
@Service()
export class UserService {
Expand All @@ -168,6 +184,9 @@ export class HomeController {
```

> Use logger and db connection


```typescript
@RestController()
export class HomeController {
Expand All @@ -180,7 +199,6 @@ export class HomeController {




<h2 align="center">Quick start</h2>
Quick start example: [link](https://github.com/typed-project/typed-framework/tree/master/wikis/start.md)

Expand Down

0 comments on commit 2c5db3a

Please sign in to comment.