-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
38 lines (36 loc) · 1.08 KB
/
index.js
File metadata and controls
38 lines (36 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
const fetch = require('node-fetch');
//get
module.exports.get = async url => await fetch(url).then(res => res.json())
//post
module.exports.post = async (url, data) => await fetch(url, {
method: "POST",
body: JSON.stringify(data),
headers: {
"Content-type": "application/json"
}
}).then(res => res.json());
//put
module.exports.put = async (url, data) => await fetch(url, {
method: "PUT",
body: JSON.stringify(data),
headers: {
"Content-type": "application/json"
}
}).then(res => res.json());
//delete
module.exports.delete = async (url, data) => await fetch(url, {
method: "DELETE",
body: JSON.stringify(data),
headers: {
"Content-type": "application/json"
}
}).then(res => res.json());
/*
npm version 可以查看你的项目的东西的版本
npm version 1.0.1 设置你项目的版本 每次都要迭代
npm adduser || npm login 两个命令都可以 添加你的npm用户
Username: strliu
Password: ***********(11位)
Email: (this IS public) 2278765105@qq.com
npm publish //上传到npm
*/