api

package module
v0.0.0-...-5acb7b5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 12, 2024 License: MPL-2.0 Imports: 4 Imported by: 0

README

Go-WarehouseServer

Go-WarehouseServer is a basic HTTP server written in Go for managing warehouse items. It uses the Gorilla Mux router for handling HTTP requests.

Features

  • Add new warehouse items
  • List all warehouse items
  • Remove warehouse items by ID

Requirements

  • Go 1.23.2 or higher

Installation

  1. Clone the repository:
    git clone https://github.com/RogelioMtz/server.git
    
  2. Navigate to the project directory:
    cd server
    
  3. Install dependencies:
    go mod tidy
    

Files

main.go

The main.go file is the main entry point for the GoWarehouseServer application. It sets up an HTTP server using the Gorilla Mux router and listens on localhost at port 8080.

go.mod

The go.mod file defines the module and its dependencies.

server.go

The server.go file contains the implementation of the server, including the router setup and handlers for the API endpoints.

warehouseRegistration.rest

The warehouseRegistration.rest file contains HTTP requests for interacting with the GoTestServer API. You can use this file with a REST client like VS Code's REST Client extension to test the API endpoints.

Usage

  1. Run the server:
    go run main.go
    
  2. Use the warehouseRegistration.rest file to interact with the server using REST API requests.

API Endpoints

  • GET /warehouseItems - List all warehouse items
  • POST /warehouseItems - Add a new warehouse item
  • DELETE /warehouseItems/{id} - Remove a warehouse item by ID

License

This project is licensed under the Mozilla Public License 2.0.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Item

type Item struct {
	ID       uuid.UUID `json:"id"`
	Name     string    `json:"name"`
	Brand    string    `json:"brand"`
	Quantity int       `json:"quantity"`
	State    string    `json:"state"`
}

type Server

type Server struct {
	*mux.Router
	// contains filtered or unexported fields
}

func NewServer

func NewServer() *Server

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL