-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
803c171
commit 7fa0e1a
Showing
4 changed files
with
126 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
from flask import Flask, render_template | ||
import requests | ||
app = Flask(__name__) | ||
|
||
@app.route('/') | ||
def home_page(): | ||
response = requests.get("https://api.npoint.io/948a893b298bc81eedf9") | ||
data = response.json() | ||
return render_template("index.html", data=data) | ||
|
||
|
||
@app.route('/blogs/<id>') | ||
def get_post(id): | ||
response = requests.get("https://api.npoint.io/948a893b298bc81eedf9") | ||
data = response.json() | ||
return render_template("blog.html", data=data, id=int(id)) | ||
|
||
|
||
if __name__ == "__main__": | ||
app.run(debug=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
body{ | ||
padding: 0; | ||
margin: 0; | ||
} | ||
.head-style{ | ||
height: 20vh; | ||
background-color: rgb(125, 255, 255); | ||
z-index: 1; | ||
} | ||
.post{ | ||
min-width: 25vw; | ||
max-width: 30vw; | ||
min-height: 30vh; | ||
margin: 2vh auto; | ||
padding: 2vh 1vw; | ||
background-color: rgb(234, 234, 233); | ||
display: flex; | ||
flex-direction: column; | ||
align-items: start; | ||
justify-content: center; | ||
} | ||
.post h2{ | ||
font-family: 'Gill Sans', 'Gill Sans MT', Calibri, 'Trebuchet MS', sans-serif; | ||
font-size: 4vh; | ||
color: chartreuse; | ||
margin: 1vh 0; | ||
} | ||
.post h4{ | ||
font-family: 'Gill Sans', 'Gill Sans MT', Calibri, 'Trebuchet MS', sans-serif; | ||
font-size: 2vh; | ||
color: rgb(255, 0, 0); | ||
margin: 1vh 0; | ||
} | ||
.post a{ | ||
text-decoration: none; | ||
font-family: 'Gill Sans', 'Gill Sans MT', Calibri, 'Trebuchet MS', sans-serif; | ||
color: coral; | ||
} | ||
.post p{ | ||
font-family: 'Gill Sans', 'Gill Sans MT', Calibri, 'Trebuchet MS', sans-serif; | ||
font-size: 4vh; | ||
} | ||
.all_posts{ | ||
z-index: 10; | ||
position: absolute; | ||
top: 8%; | ||
left: 35%; | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: center; | ||
max-width: 70%; | ||
margin: 0 auto; | ||
} | ||
.all_posts h3{ | ||
min-width: 25vw; | ||
margin: 2vh auto; | ||
display:block; | ||
} | ||
.all_posts h3{ | ||
font-family: 'Gill Sans', 'Gill Sans MT', Calibri, 'Trebuchet MS', sans-serif; | ||
font-size: 3vh; | ||
color: rgb(83, 82, 82); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>Blogs</title> | ||
<link rel="stylesheet" href="../static/styling.css"> | ||
</head> | ||
<body> | ||
<div class="head-style"></div> | ||
<div class="all_posts"> | ||
<h3>Blogs</h3> | ||
<div class="post"> | ||
<h2>{{ data[id-1]["heading"] }}</h2> | ||
<h4>{{ data[id-1]["author"] }}</h4> | ||
<p>{{ data[id-1]["text"] }}</p> | ||
</div> | ||
</div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<link rel="stylesheet" href="../static/styling.css"> | ||
<title>Blog Post</title> | ||
</head> | ||
<body> | ||
<div class="head-style"></div> | ||
|
||
<div class="all_posts"> | ||
<h3>Blogs</h3> | ||
{% for blog in data: %} | ||
<div class="post"> | ||
<h2>{{ blog["heading"] }}</h2> | ||
<h4>{{ blog["author"] }}</h4> | ||
<a href="{{ url_for('get_post', id=blog['id']) }}" id="{{ blog['id'] }}">Go to Post</a> | ||
</div> | ||
{% endfor %} | ||
</div> | ||
</body> | ||
</html> |