Skip to content

Commit

Permalink
Merge 93e48f6 into 6b4d61d
Browse files Browse the repository at this point in the history
  • Loading branch information
LorianeE committed Oct 13, 2020
2 parents 6b4d61d + 93e48f6 commit e5beee2
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 22 deletions.
8 changes: 4 additions & 4 deletions docs/docs/serve-files.md
Expand Up @@ -7,7 +7,7 @@ meta:
---
# Serve files

To serve static files such as images, CSS files, and JavaScript files, Ts.ED use `express.static` and `koa-send` for Express and Koa respectively.
To serve static files such as images, CSS files, and JavaScript files, Ts.ED uses `express.static` and `koa-send` for Express and Koa respectively.

## Configuration

Expand Down Expand Up @@ -43,7 +43,7 @@ http://localhost:3000/images/bg.png
http://localhost:3000/hello.html
```

To create a virtual path prefix (where the path does not actually exist in the file system) for files that are served by the Ts.ED, specify a mount path for the static directory, as shown below:
To create a virtual path prefix (where the path does not actually exist in the file system) for files that are served by Ts.ED, specify a mount path for the static directory, as shown below:

```typescript
import {Configuration} from "@tsed/common";
Expand Down Expand Up @@ -75,7 +75,7 @@ http://localhost:3000/static/hello.html

## Statics options

Statics options depend on which platform your work (Express, Koa, etc...).
Statics options depend on which platform you work (Express, Koa, etc...).

<Tabs class="-code">
<Tab label="Express.js">
Expand Down Expand Up @@ -117,7 +117,7 @@ interface KoaStaticsOptions {
## Expose a webapp

Exposing a webapp (React, Vue.js, Angular) with Ts.ED is quite possible.
The configuration can be a bit complicated because you have to add the right headers and redirection rule so that all queries are redirected to your webapp when the urls is managed by your front-end application.
The configuration can be a bit complicated because you have to add the right headers and redirection rule so that all queries are redirected to your webapp when the urls are managed by your front-end application.

Here is a small example to configure statics directory with the right headers and redirection rules.

Expand Down
22 changes: 11 additions & 11 deletions docs/docs/templating.md
@@ -1,7 +1,7 @@
---
meta:
- name: description
content: Use template engine with Ts.ED by using decorators. Ts.ED is built on top of Express/Koa and use TypeScript language.
content: Use template engine with Ts.ED by using decorators. Ts.ED is built on top of Express/Koa and uses TypeScript language.
- name: keywords
content: template engine consolidate ts.ed express typescript node.js javascript decorators
---
Expand All @@ -15,7 +15,7 @@ This decorator will use the data returned by the method, and the configured view
## Configuration

Ts.ED is using [consolidate](https://github.com/tj/consolidate.js) under the hood.
The default, template engine installed with Ts.ED is [EJS](https://ejs.co/).
The default template engine installed with Ts.ED is [EJS](https://ejs.co/).
If you want to use another engine, please refer to the engine documentation and [consolidate](https://github.com/tj/consolidate.js) to install the engine correctly.

<<< @/docs/docs/snippets/templating/configuration.ts
Expand All @@ -33,7 +33,7 @@ export interface PlatformViewsSettings {
*/
root?: string;
/**
* Enable cache. Ts.ED enable cache in PRODUCTION profile by default.
* Enable cache. Ts.ED enables cache in PRODUCTION profile by default.
*/
cache?: boolean;
/**
Expand Down Expand Up @@ -77,14 +77,14 @@ Here is an example of a controller using the @@View@@ decorator:

::: tip

Like Express.js or Koa.js, @@View@@ decorator use `express.response.locals` or `koa.context.state` to populate data before
Like Express.js or Koa.js, @@View@@ decorator uses `express.response.locals` or `koa.context.state` to populate data before
rendering the template. See [Locals](/docs/controllers.html#locals) decorator usage for more information.

:::

### With render method

It's also possible to render a views by injecting and using @@PlatformResponse@@ instance.
It's also possible to render a view by injecting and using @@PlatformResponse@@ instance.

<Tabs class="-code">
<Tab label="EventCtrl.ts">
Expand All @@ -106,18 +106,18 @@ It's also possible to render a views by injecting and using @@PlatformResponse@@

### With PlatformViews

Ts.ED provides the @@PlatformViews@@ service to render views. In fact, @@View@@ decorator use `PlatformResponse.render()` method which itself uses the `PlatformViews.render()` method.
It useful, if you want render a template from a service.
Ts.ED provides the @@PlatformViews@@ service to render views. In fact, @@View@@ decorator uses `PlatformResponse.render()` method which itself uses the `PlatformViews.render()` method.
It is useful if you want to render a template from a service.

<<< @/docs/docs/snippets/templating/template-platform-views.ts

## Caching

To enable caching simply pass `{ cache: true }` to the @@View@@ decorator.
All engines that consolidate.js implements I/O for will cache the file contents, ideal for production environments.
To enable caching, simply pass `{ cache: true }` to the @@View@@ decorator.
All engines that consolidate.js implements I/O for, will cache the file contents, ideal for production environments.

<<< @/docs/docs/snippets/templating/template-cache.ts

::: tip
Ts.ED enable cache by default in `PRODUCTION` profile.
:::
Ts.ED enables cache by default in `PRODUCTION` profile.
:::
4 changes: 2 additions & 2 deletions docs/docs/upload-files.md
Expand Up @@ -11,13 +11,13 @@ projects:
---
# Upload files

Ts.ED support now the uploading files by default. We use [Multer](https://github.com/expressjs/multer) module
Ts.ED supports now the uploading files by default. We use [Multer](https://github.com/expressjs/multer) module
to handle `multipart/form-data` from request.

<Projects type="examples"/>

::: tip
Originally, multer is provided by Express.js, but Ts.ED implement a multer wrapper to support Koa.js platform based on the official [@koa/multer](https://www.npmjs.com/package/@koa/multer) module.
Originally, multer is provided by Express.js, but Ts.ED implements a multer wrapper to support Koa.js platform based on the official [@koa/multer](https://www.npmjs.com/package/@koa/multer) module.
:::

## Configuration
Expand Down
4 changes: 2 additions & 2 deletions docs/tutorials/socket-io.md
Expand Up @@ -84,7 +84,7 @@ Example:
<<< @/docs/tutorials/snippets/socketio/socket-send-response.ts

::: tip
All methods accepts a promise as returned value. Ts.ED handle promise before returning a response to your consumer.
All methods accept a promise as returned value. Ts.ED handles promise before returning a response to your consumer.
:::

::: warning
Expand Down Expand Up @@ -143,4 +143,4 @@ Middlewares chain uses the `Promise` to run it. If one of this middlewares/metho

## Maintainers <Badge text="Help wanted" />

<GithubContributors users="['Romakita']"/>
<GithubContributors users="['Romakita']"/>
6 changes: 3 additions & 3 deletions docs/tutorials/typeorm.md
Expand Up @@ -79,12 +79,12 @@ We can use this model with a Controller like that:
## EntityRepository

You can create a custom repository which should contain methods to work with your database.
Usually custom repositories are created for a single entity and contains its specific queries.
Usually custom repositories are created for a single entity and contain their specific queries.
For example, let's say we want to have a method called `findByName(firstName: string, lastName: string)` which will search for users by a given first and last names.
The best place for this method is in Repository, so we could call it like `userRepository.findByName(...)`.
You can achieve this using custom repositories.

`@tsed/typeorm` plugin configures the DI so that repositories declared for TypeORM can be injected into a Ts.ED controller or service
`@tsed/typeorm` plugin configures the DI so that repositories declared for TypeORM can be injected into a Ts.ED controller or service.

The first way to create a custom repository is to extend Repository. Example:

Expand All @@ -110,4 +110,4 @@ Use @@UseConnection@@ decorator to select which database connection the injected
<a href="/contributing.html" class="nav-link button">
Become maintainer
</a>
</div>
</div>

0 comments on commit e5beee2

Please sign in to comment.