Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(middleware.md): translated & proofread 'middleware.md' #783

Closed
wants to merge 8 commits into from

Conversation

lslxdx
Copy link
Contributor

@lslxdx lslxdx commented Apr 20, 2017

Checklist
  • documentation is changed or added
Affected core subsystem(s)
Description of change

'middleware.md' is translated by @lslxdx and proofread by @闷油瓶小张

mv to #784

@codecov
Copy link

codecov bot commented Apr 20, 2017

Codecov Report

Merging #783 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@          Coverage Diff          @@
##           master   #783   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files          25     25           
  Lines         641    641           
=====================================
  Hits          641    641

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update df1bf34...206f275. Read the comment docs.

function* gzip(next) {
yield next;

// convert the reaponse body to gzip after the completion of the execution of subsequent middleware
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo: reaponse -> response

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo 👍

if (!body) return;
if (isJSON(body)) body = JSON.stringify(body);

// set gzip body, correct the reponse header
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reponse -> response

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo 👍


Usually the middleware has its own configuration. In the framework, a complete middleware is including the configuration process. We agree that a middleware is a separate file placed in `app/middleware` directory, which needs a exports function that take two paramters:

- options: the configuration field of the middleware, `app.config[${middlewareName}]` will be passed in by the frame
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

by the framework ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 You're right, it's my fault.

Next time I will paste the doc to LibreOffice (any recommendation?) to find typos before commit it.

return function* gzip(next) {
yield next;

// convert the reaponse body to gzip after the completion of the execution of subsequent middleware
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reaponse


if (isJSON(body)) body = JSON.stringify(body);

// set gzip body, correct the reponse header
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reponse


## Default Framework Middleware

In addition to the application layer middleware is imported, the framework itself and other plug-ins will also import many middleware. All the config fields of these built-in middlewares can be modified by modifying the ones with the same name in the config file, for example [Framework Built-in Plugin](https://github.com/eggjs/egg/tree/master/app/middleware) uses a bodyParser middleware(the framework loader will change the file name separated by delimiters into the camel style), and we can add configs below in `config/confg.default.js` to modify the bodyParser:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo: config/confg.default.js -> config/config.default.js

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo 👍

@popomore popomore mentioned this pull request Apr 20, 2017
48 tasks
fix typos like: 
'reaponse -> response', 'config/confg.default.js -> config/config.default.js' and so on.

Thanks to  @atian25
@lslxdx
Copy link
Contributor Author

lslxdx commented Apr 20, 2017

Fixed and the revision is 1bdef05.

@lslxdx
Copy link
Contributor Author

lslxdx commented Apr 20, 2017

What should I do next to make this PR be merged?

@atian25
Copy link
Member

atian25 commented Apr 20, 2017

@lslxdx just wait for other guys review

@fengmk2
Copy link
Member

fengmk2 commented Apr 20, 2017

Please use github email as commit author email

@lslxdx
Copy link
Contributor Author

lslxdx commented Apr 20, 2017

@fengmk2 Oops, I forgot it!

Should I re-commit the doc and create a new PR?

lslxdx added a commit to lslxdx/egg that referenced this pull request Apr 20, 2017
'middleware.md' is translated by @lslxdx and proofread by @闷油瓶小张

related issue: eggjs#783
@lslxdx
Copy link
Contributor Author

lslxdx commented Apr 20, 2017

@fengmk2 I've changed my committing name and email and then create a new PR (#784), would you please help to review it?

Thank you so much!

@popomore popomore closed this Apr 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants