Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

投稿フォームとヘッダが重なって表示されている問題を修正 #15

Open
wants to merge 1 commit into
base: main-2024
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions lib/handler-util.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@ function handleFavicon(req, res) {
res.end(favicon);
}

function handleStyleCssFile(req, res) {
res.writeHead(200, {
'Content-Type': 'text/css',
});
const file = fs.readFileSync('./public/style.css');
res.end(file);
}

function handleNotFound(req, res) {
res.writeHead(404, {
'Content-Type': 'text/plain; charset=utf-8'
Expand All @@ -41,6 +49,7 @@ function handleBadRequest(req, res) {
module.exports = {
handleLogout,
handleFavicon,
handleStyleCssFile,
handleNotFound,
handleBadRequest,
};
3 changes: 3 additions & 0 deletions lib/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ function route(req, res) {
case '/favicon.ico':
util.handleFavicon(req, res);
break;
case '/style.css':
util.handleStyleCssFile(req, res);
break;
default:
util.handleNotFound(req, res);
break;
Expand Down
1 change: 1 addition & 0 deletions views/posts.pug
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ html(lang="ja")
crossorigin="anonymous")
link(rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/[email protected]/font/bootstrap-icons.css")
link(rel="stylesheet" href="style.css")
title NNチャット
body.container.overflow-scroll
nav.navbar.fixed-top.bg-primary
Expand Down