docs: improve grammar (#362)
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user