Skip to content

Ward-R/snippetbox

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Snippetbox

This is a web application for creating and sharing code snippets, built as a guided project to learn core concepts in Go. The project is based on the book Let's Go Professional by Alex Edwards. This experience has significantly improved my understanding of topics like file handling, database models, dependency injection, and testing in a more structured way than with dynamic languages like Ruby.

https://lets-go.alexedwards.net/

SnippetHPPic SnippetView

Key Features

  • Mocking Dependencies: The application uses mock database models to facilitate testing without needing a live database connection.
  • Database Integration: It connects to a MySQL database to handle persistent storage of snippets and user information.
  • User Authentication: The application includes a user registration and login system.
  • Session Management: It uses a session manager to handle user sessions, ensuring security and continuity.
  • Routing and Handlers: The program uses Go's standard net/http package to handle routing and process requests.
  • Form Handling: It includes functionality to handle user-submitted forms, including validation and error handling.
  • Template Rendering: The application uses Go's html/template package to render dynamic HTML pages.

Built With

  • Go - Backend Programming Language
  • MySQL - Database
  • alexedwards/scs - Session Management
  • go-playground/form - Form Handling

Use

To run this application:

  1. Clone the repository:
    git clone [https://github.com/YOUR_GITHUB_USERNAME/snippetbox.git](https://github.com/YOUR_GITHUB_USERNAME/snippetbox.git)
  2. Navigate to the project directory:
    cd snippetbox
  3. Install dependencies and run the application:
    go run ./cmd/web
    (Note: You will need a configured MySQL database to run the application in production mode, as well as set the correct command-line flags. The provided code for mocking allows you to run tests without a database.)

Acknowledgements

This project is based on the book Let's Go Professional by Alex Edwards. I coded along with the material to deepen my knowledge of Go. My understanding of the language, particularly with interfaces and building a structured application, has improved greatly. While I may not 100% understand everything in the book yet, the process of building this project has been a valuable and enjoyable learning experience.

About

A snippet sharing web application built with Go. Created following the book "Let's Go" by Alex Edwards.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors