5.0.3 • Published 6 years ago

vados-bodyparser v5.0.3

Weekly downloads
53
License
ISC
Repository
-
Last release
6 years ago

vados-bodyparser

A plugin helps parse request body for vados

Installation

npm i vados-bodyparser -S

Examples

Typescript

import { GET, POST, PUT, DELETE, HEAD } from 'vados-route';
import { BODYPARSER } from 'vados-bodyparser';

export default class ChartController {
    @PUT('/chart/:id')
    @BODYPARSER([{
        autoCreate?: true, //[Boolean] Auto create folder if not existed
        mimes: string, //Can inject data by string or fix string mime type. "() => `${state.config.ext}`" or 'jpg|png|.*'
        limits: {
            fileSize: number|string//Can inject data by string or fix string mime type. "() => state.config.maxSize" or 1024 (1MB)
        },
        returnType?: String; // [String] return only path, [Object] return full object file
        returnPath?: string; // Return path after uploaded. Can inject "() => `upload/${state.auth.projectId}`" or "images/"
        name: 'images'; // Field name
        uploadDir?: string // absolute path where file will be saved to. Can inject "() => `assets/upload/${state.auth.projectId}`" or 'assets/images'
        maxCount?: number|string // Max file can be uploaded. can inject "() => state.config.maxFile" or 3(max number of files upload)
        resize?: [ // Auto resize image base on your configuration here
            {w: -1000 }, // Auto resize origin when width > 1000. If width < 1000 do nothing
            {w: 32, h: 32, ext: 'thumb'},
            {w: 224, h: 200, ext: 'list.pc'},
            {w: 358, h: 200, ext: 'list.tab'},
            {w: 270, h: 200, ext: 'list.mob'}
        ] // Can inject "() => state.config.resize"
    }])
    static async add({
		body, params
	}) {
	    body.id = params.id; // Assign body data to params which is got from client
        return body; // Return request body which is got from client
    }
}
5.0.3

6 years ago

5.0.2

6 years ago

5.0.1

6 years ago

5.0.0

6 years ago

4.0.2

6 years ago

4.0.1

6 years ago

4.0.0

6 years ago

3.0.4

6 years ago

3.0.3

6 years ago

3.0.2

6 years ago

3.0.1

6 years ago

3.0.0

6 years ago

2.0.2

6 years ago

2.0.1

6 years ago

2.0.0

6 years ago

1.0.22

6 years ago

1.0.21

6 years ago

1.0.20

6 years ago

1.0.19

6 years ago

1.0.19-alpha3

6 years ago

1.0.19-alpha2

6 years ago

1.0.19-alpha1

6 years ago

1.0.18

6 years ago

1.0.17

6 years ago

1.0.16

6 years ago

1.0.15

6 years ago

1.0.14

6 years ago

1.0.13

6 years ago

1.0.12

6 years ago

1.0.12-alpha1

6 years ago

1.0.11

6 years ago

1.0.11-alpha-9

6 years ago

1.0.11-alpha-8

6 years ago

1.0.11-alpha-7

6 years ago

1.0.11-alpha-6

6 years ago

1.0.11-alpha-5

6 years ago

1.0.11-alpha-4

6 years ago

1.0.11-alpha-3

6 years ago

1.0.11-alpha-2

6 years ago

1.0.11-alpha-1

6 years ago

1.0.11-alpha

6 years ago

1.0.10

6 years ago

1.0.9

6 years ago

1.0.8

6 years ago

1.0.7

6 years ago

1.0.7-alpha1

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago