Closed iamDistractech closed 6 years ago
Hey @iSirThijs
The CSS on /images/
doesn't get loaded, because the link
tag is setup with a relative url style.css
, so it looks in the current folder for the file. On /images/
, it'll try to fetch /images/style.css
, while it should get /style.css
. You can fix this by adding the /
in front of the file name in the link
tag! ๐
node_modules
into git. While it's only two packages now, this will grow exponentially quick when working on projects. Also, these packages all have their own repos and npm pages, so don't need to be in your repoif else if else if statements
, it makes code very hard to read and understand for people who didn't write it (eg. me ^^). Instead, you could merge certain nested ifs:// before
if (err) {
if (err.code == 'EISDIR') {
doSomething()
}
}
// after
if (err && err.code === 'EISDIR') {
doSomething()
}
or you could use the fact that a function stops doing anything after you return
a value. This pattern is often used in this case
function onRead(err, file) {
if (err) return notFound(res); // this will stop the function
return sendPage(file);
}
{
goes with which }
index.html
as a separate file, but do you send the 404
html through an inline string? ๐ค /path/to/404.html
.about
page?All in all, good job ๐
repo
I liked the assignments, but couldn't get everything working the way I want.
for example if you ask for "localhost:8000/images" it uses the css. but if you add a forward slash / to it it doesn't use the css. Tried fixing it, but I couldn't get it to work.