2 changed files with 25 additions and 0 deletions
@ -0,0 +1,14 @@ |
|||
const http = require("http"); |
|||
|
|||
const server = http.createServer((req,res) =>{ |
|||
res.statusCode = 200; |
|||
res.setHeader("Content-type", "text/html"); |
|||
res.write("Gratulace k nodeJS serveru <br>"); |
|||
res.end("Hello world\n"); |
|||
}); |
|||
|
|||
const PORT = 3000; |
|||
server.listen(PORT, () => { |
|||
console.log(`Server running at http://localhost:${PORT}/ \n Ctrl+C pro vypnuti`}) |
|||
}); |
|||
//node index.js
|
@ -0,0 +1,11 @@ |
|||
{ |
|||
"name": "webserver", |
|||
"version": "1.0.0", |
|||
"description": "Maly webserver pro uvod do NodeJS", |
|||
"main": "index.js", |
|||
"scripts": { |
|||
"test": "echo \"Error: no test specified\" && exit 1" |
|||
}, |
|||
"author": "KubMakCZ", |
|||
"license": "ISC" |
|||
} |
Loading…
Reference in new issue