Giter Site home page Giter Site logo

tech-dex / partspal Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 27.11 MB

Whether you're a car enthusiast, a mechanic, or a regular vehicle owner, PartsPal is designed to help you quickly find the exact parts you need for your vehicle maintenance or repair projects.

License: Apache License 2.0

Go 90.48% HTML 8.77% Dockerfile 0.75%

partspal's Introduction

PartsPal

Whether you're a car enthusiast, a mechanic, or a regular vehicle owner, PartsPal is designed to help you quickly find the exact parts you need for your vehicle maintenance or repair projects.

Features

  • Search and compare car parts from multiple providers
  • Real-time price and availability updates
  • User-friendly Fyne desktop application
  • Websocket API for easy integration into other applications

Getting Started

Prerequisites

Installation

  1. Clone the repository:
git clone <repository-url>
  1. Install dependencies:
go mod download

3.1. Build the Fyne application:

go build cmd/parts-pal/main.go

3.2. Build the Websocket server:

go build cmd/api/main.go
  1. Run the built executables:
./main
  1. Packaging the Fyne application (optional):
fyne package -os <operating-system> -icon <icon-file> # https://developer.fyne.io/started/packaging

Usage

Fyne Application

  1. Run the Fyne application:
./main
  1. Enter the product code information and click the "Search" button

Websocket API

  1. Run the Websocket server:
./main
  1. Connect to the server using a websocket client on localhost:3000/ws/scrape
  2. Send a simple byte message containing the product code information: "27025"
  3. The server will respond with a JSON message containing the product information. There are 2 types of messages: " bestDeal" and "deal"
  4. The "bestDeal" message contains the best deal for the product, while the "deal" message contains a deal from one of the providers

Example WebSocket Client Code (using Gorilla Websocket):

package main

import (
	"log"

	"github.com/gorilla/websocket"
)

func main() {
	// Establish a WebSocket connection
	conn, _, err := websocket.DefaultDialer.Dial("ws://localhost:3000/ws/scrape", nil)
	if err != nil {
		log.Fatal(err)
	}
	defer conn.Close()

	// Send a simple message with the product code
	err = conn.WriteMessage(websocket.TextMessage, []byte("PRODUCT_CODE"))
	if err != nil {
		log.Fatal(err)
	}

	// Receive and handle WebSocket messages
	for {
		_, message, err := conn.ReadMessage()
		if err != nil {
			log.Fatal(err)
		}
		// Handle the received message
		log.Println("Received message:", string(message))
	}
}

Replace "PRODUCT_CODE" in the code above with the actual product code you want to search for.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.