Snippetbox is a web application designed to store and manage user-submitted code 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).
Clone this repository:
git clone [email protected]: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
To run the full test suite shipped with the app, run make test
.
make test
You can contribute by forking this repo and opening pull requests with your suggestion.
All pull requests should be submitted to the main branch.
This project is licensed under the MIT License - see the LICENSE file for details.
Thanks to Alex Edwards for illustrating the development process for this app in his book Let's Go!