Skip to content

Commit

Permalink
fix(multer): Add example to use multer with Ts.ED
Browse files Browse the repository at this point in the history
  • Loading branch information
Romakita committed Feb 27, 2019
1 parent 2c6b081 commit b0fc583
Show file tree
Hide file tree
Showing 29 changed files with 11,154 additions and 328 deletions.
1 change: 1 addition & 0 deletions docs/tutorials/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Some examples are available along these links :
- [Authentication with Passport.js](https://github.com/Romakita/example-ts-express-decorator/tree/4.0.0/example-passport)
- [Mongoose & Swagger](https://github.com/Romakita/example-ts-express-decorator/tree/4.0.0/example-mongoose)
- [TypeORM](https://github.com/Romakita/ts-express-decorators/tree/production/integration/typeorm)
- [Multer](https://github.com/Romakita/ts-express-decorators/tree/production/integration/multer)

**Projects examples for v4.x.x**

Expand Down
15 changes: 8 additions & 7 deletions docs/tutorials/multer.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,10 @@ meta:
# Multer
## Installation

Before using the `@MultipartFile()` you must install [multer](https://github.com/expressjs/multer) module on your project:
Before using the `@MultipartFile()` you must install [multer](https://github.com/expressjs/multer) and `@tsed/multipartfile` module on your project:

```bash
npm install --save multer @types/multer
```
Then install `@tsed/multipartfiles`
```
npm install --save multer @tsed/multipartfiles
npm install --save multer @types/multer @tsed/multipartfiles
```

## Configure the File upload directory
Expand Down Expand Up @@ -49,7 +46,7 @@ export class Server extends ServerLoader {
## Options

- `dest` (`string`): The destination directory for the uploaded files.
- `storage` (`StoreEngine): The storage engine to use for uploaded files.
- `storage` (`StoreEngine`): The storage engine to use for uploaded files.
- `limits` (`Object`): An object specifying the size limits of the following optional properties. This object is passed to busboy directly, and the details of properties can be found on [https://github.com/mscdex/busboy#busboy-methods]([https://github.com/mscdex/busboy#busboy-methods).
- `fieldNameSize` (`number`): Max field name size (Default: 100 bytes).
- `fieldSize` (`number`): Max field value size (Default: 1MB).
Expand Down Expand Up @@ -101,3 +98,7 @@ class MyCtrl {
::: warning
Swagger spec (v2.0) doesn't support multiple files.
:::

::: tip
You can find a working example on [Multer here](https://github.com/Romakita/ts-express-decorators/tree/production/integration/multer).
:::
2 changes: 1 addition & 1 deletion integration/getting-started/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "test-ts-express-decorator",
"name": "@tsed/basic-example",
"version": "1.0.0",
"description": "",
"main": "src/index.js",
Expand Down
58 changes: 58 additions & 0 deletions integration/multer/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
### Node template
.DS_Store
# Logs
logs
*.log
npm-debug.log*

# Runtime data
pids
*.pid
*.seed

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# node-waf configuration
.lock-wscript

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directory
# https://docs.npmjs.com/misc/faq#should-i-check-my-node-modules-folder-into-git
node_modules
.npmrc
*.log

# Typings
typings/

# Typescript
src/**/*.js
src/**/*.js.map
test/**/*.js
test/**/*.js.map

# Test
/coverage
/stdout
/stderr
/es6/
/lib/
/dts/
/.tmp
/.nyc_output/

# IDE
.vscode
.idea

# Project
public
25 changes: 25 additions & 0 deletions integration/multer/.nycrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"include": [
"src/**/*.js"
],
"exclude": [
"**/index.ts",
"**/index.js",
"**/interfaces/*.js",
"**/*.spec.js",
"src/test/tools.js"
],
"reporter": [
"lcov",
"text-summary"
],
"extension": [
".ts"
],
"check-coverage": true,
"lines": 99,
"statements": 100,
"functions": 99,
"branches": 89,
"all": true
}
Loading

0 comments on commit b0fc583

Please sign in to comment.