Skip to content

Commit 26234dc

Browse files
authored
Update README.md
1 parent 9667c2c commit 26234dc

File tree

1 file changed

+8
-8
lines changed
  • .learn/exercises/03.3-your-first-route

1 file changed

+8
-8
lines changed
Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,30 @@
11
# `03.3` Creating Your First Endpoint (route)
22

3-
Since Flask is a server, it only makes sense to add some URLs to expose over the internet, for example: mydomain.com/hello
3+
Since Flask is a server, it only makes sense to add some URLs to expose over the internet, for example: `mydomain.com/hello`
44

5-
As a developer, if we would like people to visit `http://mydomain.com/hello` and show a message like `Hello World` to those people, we have to add the following endpoint inside our app.py file:
5+
As a developer, if we would like people to visit `http://mydomain.com/hello` and show a message like `Hello World` to those people, we have to add the following endpoint inside our `app.py` file:
66

77
```python
88
@app.route('/myroute', methods=['GET'])
99
def hello_world():
10-
return 'Hello, World!'
10+
return 'Hello World!'
1111
```
1212

13-
+ The first part, `@app.route('/myroute')`, specifies the enpoint that will be available to our users. In this case, users would see `mydomain.com/myroute` when visiting this route.
13+
+ The first part, `@app.route('/myroute')`, specifies the endpoint that will be available to our users. In this case, users would see `mydomain.com/myroute` when visiting this route.
1414

1515
+ The first line also specifies the methods that will be used with that URL. In this case, the `GET` method (for reading data).
1616

17-
+ The second line defines a function that will be called by Flask when that endpoint is called by the user (when the user requests `/blabla`).
17+
+ The second line defines a function that will be called by Flask when that endpoint is called by the user (when the user requests `/myroute`).
1818

19-
+ The third line defines our function execution and in this case, returns the text "Hello World" to the requesting client or browser.
19+
+ The third line defines our function execution and in this case, returns the text "Hello World!" to the requesting client or browser.
2020

21-
## 📝Instructions:
21+
## 📝 Instructions:
2222

2323
1. Using that knowledge, make your server return the string `"<h1>Hello!</h1>"` when the URL `/todos` is typed on the browser.
2424

2525
2. Please make sure that these two lines stay at the bottom of your `app.py` file. All routing and functions must remain above these two lines.
2626

2727
```python
2828
if __name__ == '__main__':
29-
app.run(host='0.0.0.0', port=3245, debug=True)
29+
app.run(host='0.0.0.0', port=3245, debug=True)
3030
```

0 commit comments

Comments
 (0)