Skip to content

This is a simple web application that sells ticket to Mars.

Notifications You must be signed in to change notification settings

gteca/going-to-mars-golang

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ticket to Mars Website

Welcome to the Ticket to Mars website, a fictitious platform that allows users to purchase tickets for a journey to Mars. This project combines a web server for user interaction and a gRPC client that communicates with a separate gRPC server to validate ticket purchase requests.

Getting Started

To run the Ticket to Mars website locally, follow these steps:

Prerequisites

  • Go installed on your machine
    • protoc for protobuf compilation (Maybe not needed). To compile protobuf, run:
$ cd payment
$ protoc --go_out=paths=source_relative:. --go-grpc_out=paths=source_relative:. payment.proto

Installation

  1. Clone this repository:

    git clone https://github.com/gteca/ticket-to-mars-website.git
    cd ticket-to-mars-website
  2. Install the Go dependencies:

    go mod download

Running the Application

  1. Start the gRPC server (Follow the instructions at api-and-grpc-server-in-golang to run the gRPC server).

  2. Start the web server:

    go run main.go

    The Ticket to Mars website will be accessible at http://localhost:8080/mars.

Features

  • User Information Form: Users can input their name, email, ticket quantity, date, and credit card number.

  • gRPC Client Integration: The web server acts as a gRPC client and communicates with the gRPC server to validate ticket purchase requests.

  • Ticket Validation: Ticket purchase depends on the response from the gRPC server, which validates the user's request.

Main page Alt Text Use Postman to display user account status Alt Text User filled data to purchase the ticket Alt Text Ticket purchased Alt Text User was charged and the current balance reflect the amount deduct from the account after the purchase Alt Text Picked second user account Alt Text Second user attemp to buy tickets which price exceed his current balance Alt Text Payment declined (The reason is logged in the GRPC client stdout) Alt Text


Enjoy your journey to Mars with Ticket to Mars! 🚀✨

About

This is a simple web application that sells ticket to Mars.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published