CRUD Operations | 211210


211210

CRUD operations for Servers

broken down handlers

So I have the basic REST crud operations for the for the server service. For the Create, Update, and delete aren’t necessary for the MVP, but I thought since i was here and for practice. For the future I will have to the create, delete, and update interface with keycloak to add/remove/update the necessary roles, but that is for a later time I really just need the GET right now and will remove them from the client.

Client -> Runner -> Mux -> Handler -> Validation -> Server CRUD function

Mux to Handler

local testing ListAll

Open 2.0 (Swagger) Meta + Docs

So looking at what needed to be done I needed a client for the frontend so I figure I’d do two things at one documentation and get some of that yummy code gen. so I did that for this primary start.

Swagger Docs with ReDocs Powered by ReDocs

Swagger docs

$ server-api/handlers/docs.go

// Package handlers classification of Server API  
//  
// Documentation for Server API  
//  
// Schemes: http  
// BasePath: /  
// Version: 0.0.1  
//  
// Consumes:  
// - application/json  
//  
// services:  
// - application/json  
//  
// swagger:meta  
package handlers  
  
import "server-api/data"  
  
// Generic error message returned as a string  
// swagger:response errorResponse  
type errorResponseWrapper struct {  
   // Description of the error  
 // in: body  Body GenericError
 ...

Serve the redocs page and the swagger.yaml Serve both the Redocs and the swagger on the base directory

Don’t think I’ll keep the yaml on forever but I think it will help with code gen once it gets on the cluster mite make it easier.

Next.js Frontend

Alright I am getting into frontend and straight up out of my element.

So I followed the Next.js quick-start guide. I have some experience with js but with bots so eh. I followed the guide to get two pages up and still need to table or something for the get call for the table.

basic is basic

Should be on the github when you see this.