helloworld
npm install happylay-helloworld#### npm包发布
1. 注册账号
2. npm init
3. 命名规范 主版本号.次版本号.修订号
``text
`
版本格式:主版本号.次版本号.修订号,版本号递增规则
主版本号:当你做了不兼容的 API 修改,
次版本号:当你做了向下兼容的功能性新增,
修订号:当你做了向下兼容的问题修正。
`
4. npm login
5. npm publish
6. npm config set registry http://registry.npmjs.com/
7. npm config set registry https://registry.npm.taobao.org/
`
注:每次改动代码需要重新发布时,都需要改动package.json中的version)
`
#### npm包管理
text
`
// 查看包管理者
npm owner ls
// 添加包管理者
npm owner add
// 删除包管理者
npm owner rm
// 删除已发布的包
npm unpublish @jdunion/[name]
`
#### babel
text
`
1.安装
npm install @babel/core @babel/cli @babel/preset-env @babel/node -D
npm install @babel/polyfill -S
2.卸载
npm uninstall @babel/core @babel/cli @babel/preset-env @babel/node -D
npm uninstall @babel/polyfill -S
`
#### 运行命令
text
`
npm run test
`
#### 搭建node后台接口
text
``
1.安装express
npm install express -S
2.引入express创建服务器
const express = require('express')
const app = express()
app.listen(8080, ()=>{
console.log('http://127.0.0.1:8080')
})
3.创建接口:http://127.0.0.1:8080/api/helloworld
app.get('/api/helloworld',(req,res) => {
return res.json({code:200,message:'Hello World'})
})