You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: nodes.go
    path of file: ./repos/storj/multinode/console/controllers
    
    the code of the file until where you have to start completion: // Copyright (C) 2020 Storj Labs, Inc.
// See LICENSE for copying information.

package controllers

import (
	"encoding/json"
	"net/http"

	"github.com/gorilla/mux"
	"github.com/zeebo/errs"
	"go.uber.org/zap"

	"storj.io/co
    
func (controller *Nodes) Delete(w http.ResponseWriter, r *http.Request) {
	ctx := r.Context()
	var err error
	defer mon.Task()(&ctx)(&err)

	w.Header().Add("Content-Type", "application/json")

	segmentParams := mux.Vars(r)

	idString, ok := segmentParams["id"]
	if !ok {
		controller.serveError(w, http.StatusBadRequest, ErrNodes.New("id segment parameter is missing"))
		return
	}

	id, err := storj.NodeIDFromString(idString)
	if err != nil {
		controller.serveError(w, http.StatusBadRequest, ErrNodes.Wrap(err))
		return
	}

	if err = controller.service.Remove(ctx, id); err != nil {
		// TODO: add more error checks in future, like not found if node is missing.
		controller.log.Error("delete node internal error", zap.Error(err))
		controller.serveError(w, http.StatusInternalServerError, ErrNodes.Wrap(err))
		return
	}
}