snippetbox

module
v0.0.0-...-e155088 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2025 License: MIT

README

Snippetbox

Snippetbox is a web application designed to store and manage user-submitted snippets. It leverages Go's templating engine for dynamic HTML rendering and utilizes MySQL for data storage.

The server uses self-signed certificates to handle HTTPS requests.

The script to generate these certificates comes embedded with the Go toolchain (see the Makefile under tls for details).

✨ Usage

Pre-requisites
Running the app

Clone this repository:

git clone git@github.com:edbar42/snippetbox.git

Go to the directory where you cloned the app in and install its Go dependencies:

go mod tidy

Run the make env to generate a template .env file for the project.

make env

Be sure to edit that .env file to suit your database setup.

You may then run the SQL scripts under pkg/db/migrations/mysql/.

Run the make tls script to generate self-signed TLS certificates for the HTTPS server:

make tls

[!WARNING] Since these certificates are self-signed, your browser will (probably) give you a warning when trying to access the website.

Finally, you can use make run to start the application:

make run

Your server should now be running on https://localhost/42069 (nice).

If you would like to delete the files generated by make, simply run make clean.

make clean
Testing

To run the full test suite shipped with the app, run make test.

make test

🤝 Contributing

You can contribute by forking this repo and opening pull requests with your suggestion.

All pull requests should be submitted to the main branch.

⚖️ License

This project is licensed under the MIT License - see the LICENSE file for details.

🙏 Acknowledgements

Thanks to Alex Edwards for illustrating the development process for this app in his book Let's Go!

Directories

Path Synopsis
cmd
web command
pkg

Jump to

Keyboard shortcuts

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