preview
ps:click the logo for links list
username:username
password:password
$ npm install # install dependencies
$ cp config.example.js config.js # set site configuration
$ npm run dev # start Node Server at port 3000
GET /api/
{
"add link": {
"POST": "/api/add",
"body": {
"tinyurl": "bd",
"fullurl": "https://www.baidu.com",
"intro": "百度"
}
},
"check unique":{
"POST": "/api/check",
"body": {
"tinyurl": "bd"
}
},
"login": {
"POST": "/api/login",
"body": {
"username": "username",
"password": "password"
}
},
"update link": {
"PUT": "/api/update/:id",
"body": {
"tinyurl": "bd",
"fullurl": "https://www.baidu.com",
"intro": "百度"
}
},
"delete link": {
"DELETE": "/api/delete/:id"
},
"get all links": {
"GET": "/api/links"
}
}
POST /api/add
名字 | 类型 | 详细描述 |
---|---|---|
tinyurl | string | 短网址字符串 |
fullurl | string | 完整网址 |
intro | string | 网址简介 |
tinyurl: bd
fullurl: https://www.baidu.com
intro: 百度
code 204
POST /api/check
名字 | 类型 | 详细描述 |
---|---|---|
tinyurl | string | 短网址字符串 |
tinyurl: bd
if used
unique: false
else
unique: true
POST /api/login
名字 | 类型 | 详细描述 |
---|---|---|
username | string | 用户名 |
password | string | 密码 |
username: username
password: password
code 204
PUT /api/update/:id
名字 | 类型 | 详细描述 |
---|---|---|
tinyurl | string | 短网址字符串 |
fullurl | string | 完整网址 |
intro | string | 网址简介 |
tinyurl: bd
fullurl: https://www.baidu.com
intro: 百度
code 204
code 204
GET /api/links
{
"links": [
{
"_id": "589f5f7fe6908f74c73869cf",
"tinyurl": "bd",
"fullurl": "https://www.baidu.com",
"intro": "百度",
"__v": 0,
"createAt": "2017-02-11T19:01:19.583Z"
}
]
}