diff --git a/docs/concepts/middleware.md b/docs/concepts/middleware.md index f3bba39f..028ec329 100644 --- a/docs/concepts/middleware.md +++ b/docs/concepts/middleware.md @@ -1,3 +1,9 @@ +--- +description: | + Add middleware routes to intercept requests or responses for analytics + purposes, access control, or anything else. +--- + A middleware is defined in a `_middleware.ts` file. It will intercept the request in order for you to perform custom logic before or after the route handler. This allows modifying or checking requests and responses. Common diff --git a/docs/getting-started/adding-interactivity.md b/docs/getting-started/adding-interactivity.md index f767bd8c..f0491ebc 100644 --- a/docs/getting-started/adding-interactivity.md +++ b/docs/getting-started/adding-interactivity.md @@ -1,3 +1,9 @@ +--- +description: | + Add JavaScript based interactivity to your project without sacrificing user + experience, by using fresh's powerful islands system. +--- + 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, diff --git a/docs/getting-started/create-a-project.md b/docs/getting-started/create-a-project.md index db768f4c..5f7a9b91 100644 --- a/docs/getting-started/create-a-project.md +++ b/docs/getting-started/create-a-project.md @@ -1,3 +1,9 @@ +--- +description: | + Create a new fresh project by running `fresh init`. This scaffolds out the + various files and folders a fresh project needs. +--- + New `fresh` projects can be created with the `fresh` CLI tool. It will scaffold out a new project with some example files to get you started. @@ -33,7 +39,7 @@ dependencies: be referenced by modules that might be shipped to the client. By default this just re-exports the `fresh` server libraries. -Finally, two folders are created that contain your routes and islands +Two important folders are also created that contain your routes and islands respectively: - **`routes/`**: This folder contains all of the routes in your project. The @@ -44,3 +50,8 @@ respectively: project. The name of each file corresponds to the name of the island defined in that file. Code inside of this folder can be run from both client and server. You'll learn more about islands later in this chapter. + +Finally a **`static/`** folder is created that contains static files that are +automatically served "as is". [Learn more about static files][static-files]. + +[static-files]: ../concepts/static-files diff --git a/docs/getting-started/create-a-route.md b/docs/getting-started/create-a-route.md index 790038e4..e8b8f187 100644 --- a/docs/getting-started/create-a-route.md +++ b/docs/getting-started/create-a-route.md @@ -1,3 +1,9 @@ +--- +description: | + Create a new route to a fresh project by creating a new file in the `routes/` + folder. +--- + 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 diff --git a/docs/getting-started/custom-handlers.md b/docs/getting-started/custom-handlers.md index 057ce531..2d6bb1cf 100644 --- a/docs/getting-started/custom-handlers.md +++ b/docs/getting-started/custom-handlers.md @@ -1,3 +1,9 @@ +--- +description: | + Add custom handlers to a route to customize HTTP headers, implement API + routes, do data fetching for a rendered page, or handle form submissions. +--- + Routes actually consist of two parts: handlers, and the page component. Up to now, only the page component has been discussed in this chapter. diff --git a/docs/getting-started/deploy-to-production.md b/docs/getting-started/deploy-to-production.md index e2f51457..25d39654 100644 --- a/docs/getting-started/deploy-to-production.md +++ b/docs/getting-started/deploy-to-production.md @@ -1,3 +1,9 @@ +--- +description: | + Deploy a fresh application to Deno Deploy in seconds, making it available on + the edge globally - resulting in fantastic user latency worldwide. +--- + As a final step in the getting started guide, we'll deploy the demo site to the public internet using [Deno Deploy][deno-deploy]. Deno Deploy is a globally distributed edge runtime built by the Deno company that allows developers to diff --git a/docs/getting-started/dynamic-routes.md b/docs/getting-started/dynamic-routes.md index 7e9a9b91..ad8153d7 100644 --- a/docs/getting-started/dynamic-routes.md +++ b/docs/getting-started/dynamic-routes.md @@ -1,3 +1,9 @@ +--- +description: | + Create a dynamic route in fresh by adding a dynamic segment to the route name + in the routes' file name on disk: `/greet/[name].tsx`. +--- + The `/about` route created on the last page is pretty static. It does not matter what query or path parameters are passed to the route, it will always render the same page. Let's create a `/greet/:name` that will render a page with a greeting diff --git a/docs/getting-started/fetching-data.md b/docs/getting-started/fetching-data.md index 7b5c5ee6..aaf0a7a1 100644 --- a/docs/getting-started/fetching-data.md +++ b/docs/getting-started/fetching-data.md @@ -1,3 +1,9 @@ +--- +description: | + Fetch data for routes dynamically by creating a custom handler and passing + data to the render function. +--- + All of the pages in the demo project so far have not used any dynamic data during rendering. In real projects, this is often different. In many cases you may need to read a file from disk (e.g. markdown for a blog post), or fetch some diff --git a/docs/getting-started/form-submissions.md b/docs/getting-started/form-submissions.md index 4e64df31..f78c8476 100644 --- a/docs/getting-started/form-submissions.md +++ b/docs/getting-started/form-submissions.md @@ -1,3 +1,9 @@ +--- +description: | + Robustly handle user inputs using HTML `