special branch without tests stuffs

This commit is contained in:
simplonco
2023-01-01 14:53:26 +01:00
parent 432a7dfdd5
commit 104fa23746
149 changed files with 0 additions and 49264 deletions

View File

@@ -1,39 +0,0 @@
//const https = require('node:https')
const http = require('http')
const fs = require('fs')
const url = require('url')
const rootName = (name) => {
fullName = __dirname + name
return fullName
}
const sendHtml = (pathName, response) => {
console.log(` name: ${pathName}`)
console.log(`namePath: ${rootName(pathName)}`)
fs.readFile(rootName(pathName), (err, data) => {
if (err) {
response.writeHead(404)
response.end('file not found')
}
else {
response.writeHead(200, {
'content-type': 'text/html; charset=utf-8'
})
response.end(data)
}
})
}
const server = http.createServer((request, response) => {
let pathName = url.parse(request.url).pathname
// read file
if (pathName.endsWith(".html"))
sendHtml(pathName, response)
})
server.listen('8080')