docs: improve grammar (#362)

This commit is contained in:
Tamal H
2022-07-04 11:21:47 +00:00
committed by GitHub
parent 9e75a5c065
commit fcff570fc1
9 changed files with 17 additions and 17 deletions
+2 -2
View File
@@ -38,8 +38,8 @@ To define a handler, one needs to export a `handler` function or object from the
route module. If the handler is an object, each key in the object is the name of
the HTTP method that the handler should be called for. For example the `GET`
handler above is called for `GET` requests. If the handler is a function, it is
called for all requests regardless of the method. If a HTTP method does not have
a corresponding handler, a 405 HTTP error is returned.
called for all requests regardless of the method. If an HTTP method does not
have a corresponding handler, a 405 HTTP error is returned.
Now, let's render some HTML using the route component:
+2 -2
View File
@@ -25,8 +25,8 @@ File names are mapped to route patterns as follows:
- Paths where the last path segment follows the structure `[...<ident>]` are
treated as having a wildcard suffix.
Here is a table of file names, and which route patterns they map to, and which
paths they might match:
Here is a table of file names, which route patterns they map to, and which paths
they might match:
| File name | Route pattern | Matching paths |
| ------------------------- | ---------------------- | -------------------------- |
+2 -2
View File
@@ -9,7 +9,7 @@ on the file extension of the file on disk. Assets are also automatically
streamed from disk to the client to improve performance and efficiency for both
user and server.
Fresh also adds an `etag` header to assets automatically, and handles the
Fresh also adds an `etag` header to assets automatically and handles the
`If-None-Match` header for incoming requests.
### Caching
@@ -19,7 +19,7 @@ in many scenarios, so fresh makes it easy to serve assets with long cache
lifetimes too.
The first approach to do this is manual. The client runtime exports an `asset`
function that takes an absolute path to the static asset, and returns a "locked"
function that takes an absolute path to the static asset and returns a "locked"
version of this path that contains a build ID for cache busting. When the asset
is requested at this "locked" path, it will be served with a cache lifetime of
one year.
+1 -1
View File
@@ -7,7 +7,7 @@ description: |
Up to now none of the pages in the demo project have contained any client side
JavaScript. This is great for resiliency and performance, but it can also limit
the possibilities of interactivity. In many current generation web frameworks,
you get the choice of shipping no JavaScript to the client, or shipping a
you get the choice of shipping no JavaScript to the client or shipping a
renderer for the entire page.
This is not very flexible, especially considering that most pages will only have
+1 -1
View File
@@ -6,7 +6,7 @@ description: |
After getting the project running locally, the next step is to add a new route
to the project. Routes encapsulate the logic for handling requests to a
particular path in your project. They can be used to handle API requests, or
particular path in your project. They can be used to handle API requests or
render HTML pages. For now we are going to do the latter.
Routes are defined as files in the `routes` directory. The file name of the
+3 -3
View File
@@ -9,11 +9,11 @@ now, only the page component has been discussed in this chapter.
Handlers are functions in the form of `Request => Response` or
`Request => Promise<Response>` that are called when a request is made to a
particular route. There can be one handler that covers all HTTP methods, or one
particular route. There can be one handler that covers all HTTP methods or one
handler per method.
The handler has access to the `Request` object that backs the request to the
route, and must return a `Response` object. The response object can either be
route and must return a `Response` object. The response object can either be
created manually (for example a JSON response for an API route), or it can be
created by rendering the page component. By default, all routes that don't
define a custom handler use a default handler that just renders the page
@@ -21,7 +21,7 @@ component.
To define a handler in a route module, one must export it as a named export with
the name `handler`. Handlers can have two forms: a plain function (catchall for
all HTTP methods), or a plain object where each property is a function named by
all HTTP methods) or a plain object where each property is a function named by
the HTTP method it handles.
Here is an example of a custom `GET` handler that renders the page component and
+1 -1
View File
@@ -18,7 +18,7 @@ one must go to the [Deno Deploy dashboard][deno-deploy-dashboard] and create a
new project.
After creating the project, head to the "Git" tab in the project settings,
select the repository, the production branch (`main`), and the entrypoint file
select the repository, the production branch (`main`) and the entrypoint file
(`main.ts`). This will link the project to the repository and automatically
deploy it to the internet. The project will now be available at
https://$PROJECT_NAME.deno.dev.
+4 -4
View File
@@ -16,10 +16,10 @@ Fresh builds the core of its form submission infrastructure around the native
chapter explains how to progressively enhance your forms with client side
JavaScript to make them more interactive.
The way forms work in the browser, is that they perform a HTML navigation action
when the user submits the form. In most cases this means that when the form is
submitted, a GET or POST request is sent to the server with the form data, which
then responds with a new page to render.
The way forms work in the browser, is that they perform an HTML navigation
action when the user submits the form. In most cases this means that when the
form is submitted, a GET or POST request is sent to the server with the form
data, which then responds with a new page to render.
Fresh can handle both GET and POST requests through the
[custom handlers][custom-handlers] feature of routes. The handlers can perform
+1 -1
View File
@@ -21,7 +21,7 @@ and the client.
Fresh also does not have a build step. The code you write is also directly the
code that is run on the server, and the code that is executed on the client. Any
necessary transpilation of TypeScript or JSX to plain JavaScript is done on the
fly, just when it is needed. This allows for insanely fast iteration loops, and
fly, just when it is needed. This allows for insanely fast iteration loops and
very very fast deployments.
Fresh projects can be deployed manually to any platform with `deno`, but it is