-
Notifications
You must be signed in to change notification settings - Fork 1
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
Showing
8 changed files
with
399 additions
and
1 deletion.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
content/posts/How I Created A Simple Python API For Generating Random Word.md
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
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
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
349 changes: 349 additions & 0 deletions
349
public/posts/how-i-created-a-simple-python-api-for-generating-random-word/index.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,349 @@ | ||
<!doctype html> | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<html | ||
class="not-ready lg:text-base" | ||
style="--bg: #faf8f1" | ||
lang="en-us" | ||
> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge" /> | ||
<meta | ||
name="viewport" | ||
content="width=device-width, initial-scale=1, shrink-to-fit=no" | ||
/> | ||
|
||
|
||
<title>How I Created A Simple Python API For Generating Random Word - Eason Li</title> | ||
|
||
|
||
<meta name="theme-color" /> | ||
|
||
|
||
|
||
|
||
|
||
<meta name="description" content="Context I created a simple Python API that generates a random word upon request. This project was inspired by Fireship’s Node.js API video. I simply created this API for fun, not as a side hustle, and I made the API open-source on my GitHub page. | ||
Creating the API First, I searched YouTube and found a video about creating a simple API using Flask. I watched the video and followed along. Then, I asked ChatGPT to generate a list of words ordered alphabetically (A-Z)." /> | ||
<meta name="author" content="Eason Li" /> | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<link rel="preload stylesheet" as="style" href="https://blog.eason.fr.to/main.min.css" /> | ||
|
||
|
||
|
||
|
||
|
||
|
||
<link rel="preload" as="image" href="https://blog.eason.fr.to/theme.png" /> | ||
|
||
|
||
|
||
|
||
|
||
<link rel="preload" as="image" href="https://www.gravatar.com/avatar/2b69b0fad4032dbef5cef82772fe16de?s=160&d=identicon" /> | ||
|
||
|
||
|
||
|
||
|
||
<link rel="preload" as="image" href="https://blog.eason.fr.to/twitter.svg" /> | ||
|
||
<link rel="preload" as="image" href="https://blog.eason.fr.to/github.svg" /> | ||
|
||
|
||
|
||
|
||
|
||
<script | ||
defer | ||
src="https://blog.eason.fr.to/highlight.min.js" | ||
onload="hljs.initHighlightingOnLoad();" | ||
></script> | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<link rel="icon" href="https://blog.eason.fr.to/favicon.ico" /> | ||
<link rel="apple-touch-icon" href="https://blog.eason.fr.to/apple-touch-icon.png" /> | ||
|
||
|
||
<meta name="generator" content="Hugo 0.124.1"> | ||
|
||
|
||
|
||
|
||
|
||
|
||
<meta itemprop="name" content="How I Created A Simple Python API For Generating Random Word"> | ||
<meta itemprop="description" content="Context I created a simple Python API that generates a random word upon request. This project was inspired by Fireship’s Node.js API video. I simply created this API for fun, not as a side hustle, and I made the API open-source on my GitHub page. | ||
Creating the API First, I searched YouTube and found a video about creating a simple API using Flask. I watched the video and followed along. Then, I asked ChatGPT to generate a list of words ordered alphabetically (A-Z)."><meta itemprop="datePublished" content="2024-04-15T13:02:04+10:00" /> | ||
<meta itemprop="dateModified" content="2024-04-15T13:02:04+10:00" /> | ||
<meta itemprop="wordCount" content="204"> | ||
<meta itemprop="keywords" content="" /> | ||
|
||
<meta property="og:title" content="How I Created A Simple Python API For Generating Random Word" /> | ||
<meta property="og:description" content="Context I created a simple Python API that generates a random word upon request. This project was inspired by Fireship’s Node.js API video. I simply created this API for fun, not as a side hustle, and I made the API open-source on my GitHub page. | ||
Creating the API First, I searched YouTube and found a video about creating a simple API using Flask. I watched the video and followed along. Then, I asked ChatGPT to generate a list of words ordered alphabetically (A-Z)." /> | ||
<meta property="og:type" content="article" /> | ||
<meta property="og:url" content="https://blog.eason.fr.to/posts/how-i-created-a-simple-python-api-for-generating-random-word/" /><meta property="article:section" content="posts" /> | ||
<meta property="article:published_time" content="2024-04-15T13:02:04+10:00" /> | ||
<meta property="article:modified_time" content="2024-04-15T13:02:04+10:00" /> | ||
|
||
|
||
<meta name="twitter:card" content="summary"/><meta name="twitter:title" content="How I Created A Simple Python API For Generating Random Word"/> | ||
<meta name="twitter:description" content="Context I created a simple Python API that generates a random word upon request. This project was inspired by Fireship’s Node.js API video. I simply created this API for fun, not as a side hustle, and I made the API open-source on my GitHub page. | ||
Creating the API First, I searched YouTube and found a video about creating a simple API using Flask. I watched the video and followed along. Then, I asked ChatGPT to generate a list of words ordered alphabetically (A-Z)."/> | ||
|
||
|
||
|
||
|
||
<link rel="canonical" href="https://blog.eason.fr.to/posts/how-i-created-a-simple-python-api-for-generating-random-word/" /> | ||
|
||
|
||
</head> | ||
|
||
<body class="text-black duration-200 ease-out dark:text-white"> | ||
<header class="mx-auto flex h-[4.5rem] max-w-3xl px-8 lg:justify-center"> | ||
<div class="relative z-50 mr-auto flex items-center"> | ||
<a | ||
class="-translate-x-[1px] -translate-y-[1px] text-2xl font-semibold" | ||
href="https://blog.eason.fr.to/" | ||
>Eason Li</a | ||
> | ||
<div | ||
class="btn-dark text-[0] ml-4 h-6 w-6 shrink-0 cursor-pointer [background:url(./theme.png)_left_center/_auto_theme('spacing.6')_no-repeat] [transition:_background-position_0.4s_steps(5)] dark:[background-position:right]" | ||
role="button" | ||
aria-label="Dark" | ||
></div> | ||
</div> | ||
|
||
<div | ||
class="btn-menu relative z-50 -mr-8 flex h-[4.5rem] w-[5rem] shrink-0 cursor-pointer flex-col items-center justify-center gap-2.5 lg:hidden" | ||
role="button" | ||
aria-label="Menu" | ||
></div> | ||
|
||
|
||
|
||
<script> | ||
|
||
const htmlClass = document.documentElement.classList; | ||
setTimeout(() => { | ||
htmlClass.remove('not-ready'); | ||
}, 10); | ||
|
||
|
||
const btnMenu = document.querySelector('.btn-menu'); | ||
btnMenu.addEventListener('click', () => { | ||
htmlClass.toggle('open'); | ||
}); | ||
|
||
|
||
const metaTheme = document.querySelector('meta[name="theme-color"]'); | ||
const lightBg = '#faf8f1'.replace(/"/g, ''); | ||
const setDark = (isDark) => { | ||
metaTheme.setAttribute('content', isDark ? '#000' : lightBg); | ||
htmlClass[isDark ? 'add' : 'remove']('dark'); | ||
localStorage.setItem('dark', isDark); | ||
}; | ||
|
||
|
||
const darkScheme = window.matchMedia('(prefers-color-scheme: dark)'); | ||
if (htmlClass.contains('dark')) { | ||
setDark(true); | ||
} else { | ||
const darkVal = localStorage.getItem('dark'); | ||
setDark(darkVal ? darkVal === 'true' : darkScheme.matches); | ||
} | ||
|
||
|
||
darkScheme.addEventListener('change', (event) => { | ||
setDark(event.matches); | ||
}); | ||
|
||
|
||
const btnDark = document.querySelector('.btn-dark'); | ||
btnDark.addEventListener('click', () => { | ||
setDark(localStorage.getItem('dark') !== 'true'); | ||
}); | ||
</script> | ||
|
||
<div | ||
class="nav-wrapper fixed inset-x-0 top-full z-40 flex h-full select-none flex-col justify-center pb-16 duration-200 dark:bg-black lg:static lg:h-auto lg:flex-row lg:!bg-transparent lg:pb-0 lg:transition-none" | ||
> | ||
|
||
|
||
|
||
|
||
<nav | ||
class="mt-12 flex justify-center space-x-10 dark:invert lg:ml-12 lg:mt-0 lg:items-center lg:space-x-6" | ||
> | ||
|
||
<a | ||
class="h-8 w-8 text-[0] [background:var(--url)_center_center/cover_no-repeat] lg:h-6 lg:w-6" | ||
style="--url: url(./twitter.svg)" | ||
href="https://twitter.com/404" | ||
target="_blank" | ||
rel="me" | ||
> | ||
</a> | ||
|
||
<a | ||
class="h-8 w-8 text-[0] [background:var(--url)_center_center/cover_no-repeat] lg:h-6 lg:w-6" | ||
style="--url: url(./github.svg)" | ||
href="https://github.com/eli32-vlc" | ||
target="_blank" | ||
rel="me" | ||
> | ||
github | ||
</a> | ||
|
||
</nav> | ||
|
||
</div> | ||
</header> | ||
|
||
|
||
<main | ||
class="prose prose-neutral relative mx-auto min-h-[calc(100%-9rem)] max-w-3xl px-8 pb-16 pt-12 dark:prose-invert" | ||
> | ||
|
||
|
||
<article> | ||
<header class="mb-16"> | ||
<h1 class="!my-0 pb-2.5">How I Created A Simple Python API For Generating Random Word</h1> | ||
|
||
|
||
<div class="text-sm antialiased opacity-60"> | ||
|
||
<time>Apr 15, 2024</time> | ||
|
||
|
||
|
||
|
||
</div> | ||
|
||
</header> | ||
|
||
<section><h3 id="context">Context</h3> | ||
<p>I created a simple Python API that generates a random word upon request. This project was inspired by Fireship’s Node.js API video. I simply created this API for fun, not as a side hustle, and I made the API open-source on my GitHub page.</p> | ||
<h3 id="creating-the-api">Creating the API</h3> | ||
<p>First, I searched YouTube and found a video about creating a simple API using Flask. I watched the video and followed along. Then, I asked ChatGPT to generate a list of words ordered alphabetically (A-Z). Next, I created a Python variable to store the list of words. Finally, I replaced the emoji used in the video with the variable.</p> | ||
<h3 id="deployment">Deployment</h3> | ||
<p>It was time to deploy the API. I needed a free hosting option. I found some free choices like Cyclic.sh, but I ended up using PythonAnywhere.com because it’s free and easy to use. I created an account, uploaded the code to the server, uploaded my code to GitHub, and wrote a README.md file to explain how to use the API. And that’s it! I created a simple Python API for generating random words!</p> | ||
<blockquote> | ||
<p>Here is the link to the <a href="https://github.com/eli32-vlc/api">GitHub repository</a></p> | ||
</blockquote> | ||
<h4 id="thanks-for-reading">Thanks for Reading!</h4> | ||
<blockquote> | ||
<p>This blog post is writtin by Eason and edited by Google Bard.</p> | ||
</blockquote> | ||
</section> | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<nav class="mt-24 flex rounded-lg bg-black/[3%] text-lg dark:bg-white/[8%]"> | ||
|
||
|
||
<a | ||
class="ml-auto flex w-1/2 items-center justify-end rounded-r-md p-6 pl-3 font-semibold no-underline hover:bg-black/[2%] dark:hover:bg-white/[3%]" | ||
href="https://blog.eason.fr.to/posts/random-word-api/" | ||
><span>Random Word API</span><span class="ml-1.5">→</span></a | ||
> | ||
|
||
</nav> | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
</article> | ||
|
||
|
||
</main> | ||
|
||
<footer | ||
class="opaco mx-auto flex h-[4.5rem] max-w-3xl items-center px-8 text-[0.9em] opacity-60" | ||
> | ||
<div class="mr-auto"> | ||
© 2024 | ||
<a class="link" href="https://blog.eason.fr.to/">Eason Li</a> | ||
</div> | ||
<a class="link mx-6" href="https://gohugo.io/" rel="noopener" target="_blank" | ||
>Powered by Hugo️️</a | ||
>️ | ||
<a | ||
class="link" | ||
href="https://github.com/nanxiaobei/hugo-paper" | ||
rel="noopener" | ||
target="_blank" | ||
>✎ Paper</a | ||
> | ||
</footer> | ||
|
||
</body> | ||
</html> |
Oops, something went wrong.