C:\Users\bit>node -v
v14.16.0
C:\Users\bit>cd documents
C:\Users\bit\Documents>mkdir boiler-plate
C:\Users\bit\Documents>cd boiler-plate
C:\Users\bit\Documents\boiler-plate>npm init
This utility will walk you through creating a package.json file.
It only covers the most common items, and tries to guess sensible defaults.
See `npm help init` for definitive documentation on these fields
and exactly what they do.
Use `npm install <pkg>` afterwards to install a package and
save it as a dependency in the package.json file.
Press ^C at any time to quit.
package name: (boiler-plate)
version: (1.0.0)
description:
entry point: (index.js)
test command:
git repository:
keywords:
author:
license: (ISC)
About to write to C:\Users\bit\Documents\boiler-plate\package.json:
{
"name": "boiler-plate",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC"
}
Is this OK? (yes)
expressjs.com/en/starter/hello-world.html
Express "Hello World" example
Hello world example Embedded below is essentially the simplest Express app you can create. It is a single file app — not what you’d get if you use the Express generator, which creates the scaffolding for a full app with numerous JavaScript files, Jade
expressjs.com
const express = require('express')
const app = express()
const port = 3000
app.get('/', (req, res) => { res.send('Hello World!')})
app.listen(port, () => { console.log(`Example app listening at http://localhost:${port}`)})
'nodejs' 카테고리의 다른 글
node ip 클라이언트 ip 가져오기 (0) | 2022.02.14 |
---|---|
node 에서 서버 파일 다운로드 시키기 (0) | 2022.02.14 |
NODE 에서 파일 저장하기 :: FS 이용 (2) | 2022.02.07 |
[nodejs] 데이터 받기 body-parser (0) | 2021.02.24 |