diff --git a/backend/main.go b/backend/main.go
index cfd51010..b6bb191d 100644
--- a/backend/main.go
+++ b/backend/main.go
@@ -91,6 +91,7 @@ func main() {
app.POST("/nodes/:id", routes.PostNode) // 修改节点
app.GET("/nodes/:id/tasks", routes.GetNodeTaskList) // 节点任务列表
app.GET("/nodes/:id/system", routes.GetSystemInfo) // 节点任务列表
+ app.DELETE("/nodes/:id", routes.DeleteNode) // 删除节点
// 爬虫
app.GET("/spiders", routes.GetSpiderList) // 爬虫列表
app.GET("/spiders/:id", routes.GetSpider) // 爬虫详情
diff --git a/backend/routes/node.go b/backend/routes/node.go
index 756af958..f86c152d 100644
--- a/backend/routes/node.go
+++ b/backend/routes/node.go
@@ -108,3 +108,21 @@ func GetSystemInfo(c *gin.Context) {
Data: sysInfo,
})
}
+
+func DeleteNode(c *gin.Context) {
+ id := c.Param("id")
+ node, err := model.GetNode(bson.ObjectIdHex(id))
+ if err != nil {
+ HandleError(http.StatusInternalServerError, c ,err)
+ return
+ }
+ err = node.Delete()
+ if err != nil {
+ HandleError(http.StatusInternalServerError, c, err)
+ return
+ }
+ c.JSON(http.StatusOK, Response{
+ Status: "ok",
+ Message: "success",
+ })
+}
diff --git a/frontend/src/views/node/NodeList.vue b/frontend/src/views/node/NodeList.vue
index 3ec7ea18..8542d753 100644
--- a/frontend/src/views/node/NodeList.vue
+++ b/frontend/src/views/node/NodeList.vue
@@ -114,7 +114,7 @@
-
+