Gitlab@Informatics

Skip to content
Snippets Groups Projects
Commit 9df46272 authored by 65160258's avatar 65160258
Browse files

search

parent 9398a2dd
No related branches found
No related tags found
No related merge requests found
...@@ -136,7 +136,7 @@ router.get('/search', async (req, res) => { ...@@ -136,7 +136,7 @@ router.get('/search', async (req, res) => {
ORDER BY p.created_at DESC`, ORDER BY p.created_at DESC`,
[`%${keyword}%`] [`%${keyword}%`]
); );
res.render('posts/index', { posts }); res.render('pages/index', { posts });
} catch (error) { } catch (error) {
console.error('Error searching posts:', error); console.error('Error searching posts:', error);
res.status(500).send('Internal Server Error'); res.status(500).send('Internal Server Error');
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
<p class="mb-1 fw-bold text-dark"><%= user.username %></p> <p class="mb-1 fw-bold text-dark"><%= user.username %></p>
</div> </div>
<% } %> <% } %>
<form action="/posts/search" method="get"> <form action="/index/search" method="get">
<input type="text" name="keyword" placeholder="ค้นหาบทความ"> <input type="text" name="keyword" placeholder="ค้นหาบทความ">
<button type="submit">ค้นหา</button> <button type="submit">ค้นหา</button>
</form> </form>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment