https://nodejs.org/dist/latest-v16.x/docs/api/synopsis.html
Usage and example | Node.js v16.16.0 Documentation
Usage and example# Usage# node [options] [V8 options] [script.js | -e "script" | - ] [arguments] Please see the Command-line options document for more information. Example# An example of a web server written with Node.js which responds with 'Hello, World!'
nodejs.org
위 사이트를 따라하면 hello world!를 출력할 수 있다.
const http = require('http');
const hostname = '127.0.0.1';
const port = 3000;
const server = http.createServer((req, res) => {
res.statusCode = 200;
res.setHeader('Content-Type', 'text/plain');
res.end('Hello, World!\n');
});
server.listen(port, hostname, () => {
console.log(`Server running at http://${hostname}:${port}/`);
});
'Node.js' 카테고리의 다른 글
package.json (0) | 2022.07.21 |
---|---|
axios : XMLHttpRequests 모듈 (0) | 2022.07.20 |
nodejs 외부 js파일(모듈) 함수 호출하기 (0) | 2022.07.20 |
nodejs console 입력받기 (readline, readline-sync module) (0) | 2022.07.20 |
Node.js 설치 (0) | 2022.07.15 |