-
Notifications
You must be signed in to change notification settings - Fork 0
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
1 parent
e031837
commit 8746cc4
Showing
5 changed files
with
76 additions
and
0 deletions.
There are no files selected for viewing
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,14 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>Movie API Documentation</title> | ||
</head> | ||
<body> | ||
<h1>Welcome to the Movie API Documentation</h1> | ||
<p> | ||
This API provides access to a database of movies. You can retrieve | ||
information about movies, search for movies, and add new movies to the | ||
database. | ||
</p> | ||
</body> | ||
</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,11 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>Document</title> | ||
</head> | ||
<body> | ||
<h1>index - movie api!</h1> | ||
</body> | ||
</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,6 @@ | ||
URL: /documentation | ||
Timestamp: Wed Nov 15 2023 13:17:22 GMT+0100 (Central European Standard Time) | ||
|
||
URL: /favicon.ico | ||
Timestamp: Wed Nov 15 2023 13:17:22 GMT+0100 (Central European Standard Time) | ||
|
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,40 @@ | ||
const http = require("http"), | ||
fs = require("fs"), | ||
url = require("url"); | ||
|
||
http | ||
.createServer((request, response) => { | ||
let addr = request.url, | ||
q = new URL(addr, "http://" + request.headers.host), | ||
filePath = ""; | ||
|
||
fs.appendFile( | ||
"log.txt", | ||
"URL: " + addr + "\nTimestamp: " + new Date() + "\n\n", | ||
(err) => { | ||
if (err) { | ||
console.log(err); | ||
} else { | ||
console.log("Added to log."); | ||
} | ||
} | ||
); | ||
|
||
if (q.pathname.includes("documentation")) { | ||
filePath = __dirname + "/documentation.html"; | ||
} else { | ||
filePath = "index.html"; | ||
} | ||
|
||
fs.readFile(filePath, (err, data) => { | ||
if (err) { | ||
throw err; | ||
} | ||
|
||
response.writeHead(200, { "Content-Type": "text/html" }); | ||
response.write(data); | ||
response.end(); | ||
}); | ||
}) | ||
.listen(8080); | ||
console.log("My test server is running on Port 8080."); |
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,5 @@ | ||
console.log("Hello Node!"); | ||
|
||
console.log("Goodbye"); | ||
|
||
const bufs = Buffer.from([1, 2, 3, 4]); |