You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: book/asciidoc/yesod-typeclass.asciidoc
+10-10Lines changed: 10 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -47,7 +47,7 @@ still need to deal with ports. And even if we get the port number from the
47
47
request, are we using HTTP or HTTPS? And even if you know _that_, such an
48
48
approach would mean that, depending on how the user submitted a request would
49
49
generate different URLs. For example, we would generate different URLs
50
-
depending if the user connected to "example.com" or "www.example.com". For
50
+
depending on if the user connected to "example.com" or "www.example.com". For
51
51
Search Engine Optimization, we want to be able to consolidate on a single
52
52
canonical URL.
53
53
@@ -368,13 +368,13 @@ In fact, you could even use special responses like redirects:
368
368
NOTE: Even though you _can_ do this, I don't actually recommend such practices.
369
369
A 404 should be a 404.
370
370
371
-
=== External CSS and Javascript
371
+
=== External CSS and JavaScript
372
372
373
373
NOTE: The functionality described here is automatically included in the scaffolded site, so you don't need to worry about implementing this yourself.
374
374
375
375
One of the most powerful, and most intimidating, methods in the Yesod typeclass
376
376
is +addStaticContent+. Remember that a Widget consists of multiple components,
377
-
including CSS and Javascript. How exactly does that CSS/JS arrive in the user's
377
+
including CSS and JavaScript. How exactly does that CSS/JS arrive in the user's
378
378
browser? By default, they are served in the +<head>+ of the page, inside
379
379
+<style>+ and +<script>+ tags, respectively.
380
380
@@ -412,7 +412,7 @@ The scaffolded +addStaticContent+ does a number of intelligent things to help
412
412
you out:
413
413
414
414
415
-
* It automatically minifies your Javascript using the hjsmin package.
415
+
* It automatically minifies your JavaScript using the hjsmin package.
416
416
* It names the output files based on a hash of the file contents. This means
417
417
you can set your cache headers to far in the future without fears of stale
418
418
content.
@@ -461,19 +461,19 @@ Yesod, it's just plain old Haskell. There are three methods involved:
461
461
isWriteRequest:: Determine if the current request is a "read" or "write" operations. By default, Yesod follows RESTful principles, and assumes +GET+, +HEAD+, +OPTIONS+, and +TRACE+ requests are read-only, while all others are writable.
462
462
463
463
isAuthorized:: Takes a route (i.e., type-safe URL) and a boolean indicating whether or not the request is a write request. It returns an +AuthResult+, which can have one of three values:
464
-
* +Authorized+
465
-
* +AuthenticationRequired+
466
-
* +Unauthorized+
464
+
* +Authorized+
465
+
* +AuthenticationRequired+
466
+
* +Unauthorized+
467
467
468
468
By default, it returns +Authorized+ for all requests.
469
469
470
470
authRoute:: If +isAuthorized+ returns +AuthenticationRequired+, then redirect
471
471
to the given route. If no route is provided (the default), return a 401
472
472
``authentication required'' message.
473
473
474
-
These methods tie in nicely with the yesod-auth package, which is used by the
475
-
scaffolded site to provide a number of authentication options, such as OpenID,
476
-
Mozilla Persona, email, username and Twitter. We'll cover more concrete
474
+
These methods tie in nicely with the yesod-auth package, which is used
475
+
by the scaffolded site to provide a number of authentication options,
476
+
such as OpenID, email, username and Twitter. We'll cover more concrete
0 commit comments