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
The example above creates an endpoint returning the current date and time available at `/time`. The exact response will be
42
+
The example above creates an endpoint, returning the current date and time available at `/time`. The exact response will be
43
43
recreated every time you refresh the webpage.
44
44
45
-
Since the endpoint method has `String` output type, the result will be sent with `text/plain`[content type](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Type).
46
-
If you want an HTML output being interpreted by the browser, you else need to set the `Content-Type` header manually
45
+
Since the endpoint method has the `String` output type, the result will be sent with `text/plain`[content type](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Type).
46
+
If you want an HTML output to be interpreted by the browser, you will need to set the `Content-Type` header manually
47
47
or [use the Scalatags templating library](/toolkit/web-server-dynamic.html#using-html-templates), supported by Cask.
48
48
49
49
### Running the example
@@ -71,15 +71,15 @@ In the terminal, the following command will start the server:
71
71
{% endtab %}
72
72
{% endtabs %}
73
73
74
-
Access [the endpoint](http://localhost:8080/time). You should see a result similar to the one below.
74
+
Access the endpoint at [http://localhost:8080/time](http://localhost:8080/time). You should see a result similar to the one below.
75
75
76
76
```
77
77
Current date is: 2024-07-22T09:07:05.752534+02:00[Europe/Warsaw]
78
78
```
79
79
80
80
## Using path segments
81
81
82
-
Cask gives you the ability to access segments of the URL path withing the endpoint function.
82
+
Cask gives you the ability to access segments of the URL path within the endpoint function.
83
83
Building on the example above, you can add a segment to specify that the endpoint should return the date and time
Copy file name to clipboardExpand all lines: _overviews/toolkit/web-server-intro.md
+5-5
Original file line number
Diff line number
Diff line change
@@ -9,15 +9,15 @@ next-page: web-server-static
9
9
10
10
Cask is an HTTP micro-framework, providing a simple and flexible way to build web applications.
11
11
12
-
Its main focus is on the ease of use, which makes it ideal for newcomers, at cost of eschewing some features other
12
+
Its main focus is on the ease of use, which makes it ideal for newcomers, at the cost of eschewing some features other
13
13
frameworks provide, like asynchronicity.
14
14
15
-
To define an endpoint it's enough to annotate a function with an appropriate annotation, specifying the request path.
16
-
Cask allows for building the response manually using tools the Cask library provides, specifying the content, headers,
17
-
status code etc. An endpoint function can also just return a string, [uPickle](https://com-lihaoyi.github.io/upickle/) JSON type, or a [Scalatags](https://com-lihaoyi.github.io/scalatags/)
15
+
To define an endpoint it's enough to annotate a function with an annotation specifying the request path.
16
+
Cask allows for building the response manually using tools Cask library provides, specifying the content, headers,
17
+
status code, etc. An endpoint function can also just return a string, a[uPickle](https://com-lihaoyi.github.io/upickle/) JSON type, or a [Scalatags](https://com-lihaoyi.github.io/scalatags/)
18
18
template and Cask will automatically create a response, setting all the necessary headers.
19
19
20
-
Cask comes bundled with uPickle library for handling JSONs, supports WebSockets and allows for extending endpoints with
20
+
Cask comes bundled with the uPickle library for handling JSONs, supports WebSockets and allows for extending endpoints with
21
21
decorators, which can be used to handle authentication or rate limiting.
22
22
23
23
{% include markdown.html path="_markdown/install-cask.md" %}
0 commit comments