Skip to content

Latest commit

History

270 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

Snippets app

This snippets app lets you store, edit, and manage reusable pieces of text or code — fast, organized, and always ready to copy-paste.

Preview 1Preview 2
Snippets app preview 1Snippets app preview 2
Preview 3Preview 4
Snippets app preview 3Snippets app preview 4

Stack

  • Golang
  • Mux (Router)
  • Go SQL Driver (Database)
  • Alice (Middleware)
  • NoSurf (CSRF protection)

How to run

1. Clone the repo

git clone https://github.com/takumade/snippets

2. Change directory

cd snippets

3. Database setup

Create database:

CREATEDATABASEsnippetbox;
CREATEUSER 'web'@'localhost' WITH PASSWORD 'pass';
GRANT ALL PRIVILEGES ON snippetbox.* TO 'web'@'localhost';
FLUSH PRIVILEGES;

Create tables:

internal/db/users.sqlinternal/db/snippets.sqlinternal/db/sessions.sql

4. Install dependencies

go mod tidy

5. Install certs

mkdir tls &&cd tls && go run /usr/local/go/src/crypto/tls/generate_cert.go --rsa-bits=2048 --host=localhost

6. Run the server

go run ./cmd/web

Open your browser and navigate to http://localhost:4000

7. Runnning Tests

Simply run the following command:

go test -v ./cmd/web

About

This snippets app lets you store, edit, and manage reusable pieces of text or code — fast, organized, and always ready to copy-paste.

Topics

Resources

Stars

1 star

Watchers

1 watching

Forks

Packages

Used by

Contributors

Languages