Skip to content

Commit 2190b60

Browse files
authored
x.vweb: fix typos in README.md (#20856)
1 parent 5fe5412 commit 2190b60

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

vlib/x/vweb/README.md

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ pub mut:
5656
pub struct App {
5757
pub:
5858
// In the app struct we store data that should be accessible by all endpoints.
59-
// For example a database or configuration values.
59+
// For example, a database or configuration values.
6060
secret_key string
6161
}
6262
@@ -122,7 +122,7 @@ pub fn (app &App) create_product(mut ctx Context) vweb.Result {
122122
}
123123
```
124124

125-
By default endpoints are marked as GET requests only. It is also possible to
125+
By default, endpoints are marked as GET requests only. It is also possible to
126126
add multiple HTTP verbs per endpoint.
127127

128128
**Example:**
@@ -185,7 +185,7 @@ If you want multiple parameters in your route and if you want to parse the param
185185
yourself, or you want a wildcard route, you can add `...` after the `:` and name,
186186
e.g. `@['/:path...']`.
187187

188-
This will match all routes after `'/'`. For example the url `/path/to/test` would give
188+
This will match all routes after `'/'`. For example, the url `/path/to/test` would give
189189
`path = '/path/to/test'`.
190190

191191
```v ignore
@@ -202,8 +202,8 @@ You have direct access to query values by accessing the `query` field on your co
202202
You are also able to access any formdata or files that were sent
203203
with the request with the fields `.form` and `.files` respectively.
204204

205-
In the following example, visiting http://localhost:port/user?name=Vweb we
206-
will see the text `Hello Vweb!`. And if we access the route without the `name` parameter,
205+
In the following example, visiting http://localhost:port/user?name=vweb we
206+
will see the text `Hello vweb!`. And if we access the route without the `name` parameter,
207207
http://localhost:port/user, we will see the text `no user was found`,
208208

209209
**Example:**
@@ -249,7 +249,7 @@ host in one app struct.
249249

250250
### Route Matching Order
251251

252-
Vweb will match routes in the order that you define endpoints.
252+
vweb will match routes in the order that you define endpoints.
253253

254254
**Example:**
255255
```v ignore
@@ -270,7 +270,7 @@ on the url http://localhost:port/normal we will not see `from normal`, but
270270

271271
### Custom not found page
272272

273-
You can implement a `not_found` endpoint that is called when a request is made and no
273+
You can implement a `not_found` endpoint that is called when a request is made, and no
274274
matching route is found to replace the default HTTP 404 not found page. This route
275275
has to be defined on our Context struct.
276276

@@ -286,7 +286,7 @@ pub fn (mut ctx Context) not_found() vweb.Result {
286286

287287
## Static files and website
288288

289-
Vweb also provides a way of handling static files. We can mount a folder at the root
289+
vweb also provides a way of handling static files. We can mount a folder at the root
290290
of our web app, or at a custom route. To start using static files we have to embed
291291
`vweb.StaticHandler` on our app struct.
292292

@@ -303,7 +303,7 @@ Let's say you have the following file structure:
303303
└── main.v
304304
```
305305

306-
If we want all the documents inside the `static` sub-directory to be publicly accessible we can
306+
If we want all the documents inside the `static` sub-directory to be publicly accessible, we can
307307
use `handle_static`.
308308

309309
> **Note:**
@@ -352,7 +352,7 @@ We can now access `main.css` directly at http://localhost:8080/css/main.css.
352352
If a request is made to the root of a static folder, vweb will look for an
353353
`index.html` or `ìndex.htm` file and serve it if available.
354354
Thus, it's also a good way to host a complete website.
355-
A example is available [here](/examples/vweb/static_website).
355+
An example is available [here](/examples/vweb/static_website).
356356

357357
It is also possible to mount the `static` folder at a custom path.
358358

@@ -376,7 +376,7 @@ app.serve_static('/path/main.css', 'static/css/main.css')!
376376

377377
### Dealing with MIME types
378378

379-
By default vweb will map the extension of a file to a MIME type. If any of your static file's
379+
By default, vweb will map the extension of a file to a MIME type. If any of your static file's
380380
extensions do not have a default MIME type in vweb, vweb will throw an error and you
381381
have to add your MIME type to `.static_mime_types` yourself.
382382

@@ -505,7 +505,7 @@ app.route_use('/user/:path...')
505505

506506
### Evaluation moment
507507

508-
By default the registered middleware functions are executed *before* a method on your
508+
By default, the registered middleware functions are executed *before* a method on your
509509
app struct is called. You can also change this behaviour to execute middleware functions
510510
*after* a method on your app struct is called, but before the response is sent!
511511

@@ -530,7 +530,7 @@ Anything you can do in "before" middleware, you can do in "after" middleware.
530530

531531
### Evaluation order
532532

533-
Vweb will handle requests in the following order:
533+
vweb will handle requests in the following order:
534534

535535
1. Execute global "before" middleware
536536
2. Execute "before" middleware that matches the requested route
@@ -574,7 +574,7 @@ for urls starting with `'/foo'`.
574574

575575
To use controllers we have to embed `vweb.Controller` on
576576
our app struct and when we register a controller we also have to specify
577-
what the type of the context struct will be. That means that is is possible
577+
what the type of the context struct will be. That means that it is possible
578578
to have a different context struct for each controller and the main app struct.
579579

580580
**Example:**
@@ -642,7 +642,7 @@ When we registered the controller with
642642
we told vweb that the namespace of that controller is `'/admin'` so in this example we would
643643
see the text "Admin" if we navigate to the url `'/admin/path'`.
644644

645-
Vweb doesn't support duplicate routes, so if we add the following
645+
vweb doesn't support duplicate routes, so if we add the following
646646
route to the example the code will produce an error.
647647

648648
```v ignore
@@ -778,7 +778,7 @@ You must pass the type of redirect to vweb:
778778

779779
If you want to change the request method, for example when you receive a post request and
780780
want to redirect to another page via a GET request, you should use `see_other`. If you want
781-
the HTTP method to stay the same you should use `found` generally speaking.
781+
the HTTP method to stay the same, you should use `found` generally speaking.
782782

783783
**Example:**
784784
```v ignore
@@ -825,7 +825,7 @@ sending a response over the connection and closing it.
825825
Sometimes you want to send the response in another thread, for example when using
826826
[Server Sent Events](sse/README.md). When you are sure that a response will be sent
827827
over the TCP connection you can return `vweb.no_result()`. This function does nothing
828-
and returns an empty `vweb.Result` struct, letting vweb know that we sent a response ourself.
828+
and returns an empty `vweb.Result` struct, letting vweb know that we sent a response ourselves.
829829

830830
> **Note:**
831831
> It is important to call `ctx.takeover_conn` before you spawn a thread
@@ -856,7 +856,7 @@ pub fn (app &App) long_response(mut ctx Context) vweb.Result {
856856
// if we don't the whole web server will block for 10 seconds,
857857
// since vweb is singlethreaded
858858
spawn handle_connection(mut ctx.conn)
859-
// we will send a custom response ourself, so we can safely return an empty result
859+
// we will send a custom response ourselves, so we can safely return an empty result
860860
return vweb.no_result()
861861
}
862862

0 commit comments

Comments
 (0)