happylay-helloworld

helloworld

Usage no npm install needed!

<script type="module">
  import happylayHelloworld from 'https://cdn.skypack.dev/happylay-helloworld';
</script>

README

npm包发布

  1. 注册账号

  2. npm init

  3. 命名规范 主版本号.次版本号.修订号

版本格式:主版本号.次版本号.修订号,版本号递增规则

主版本号:当你做了不兼容的 API 修改,
次版本号:当你做了向下兼容的功能性新增,
修订号:当你做了向下兼容的问题修正。

  1. npm login

  2. npm publish

  3. npm config set registry http://registry.npmjs.com/

  4. npm config set registry https://registry.npm.taobao.org/

注:每次改动代码需要重新发布时,都需要改动package.json中的version)

npm包管理

// 查看包管理者
npm owner ls <package name> 

// 添加包管理者
npm owner add <user> <package name> 

// 删除包管理者
npm owner rm <user> <package name>

 // 删除已发布的包
npm unpublish @jdunion/[name] 

babel

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

运行命令

npm run test

搭建node后台接口

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'})
})