Journal

A simple web-based journal written in Go. You can post, edit and view entries,
witht he addition of an API.
It makes use of a SQLite database to store the journal entries.
API Documentation
Installation and Setup (local method)
- Clone the repository to
$GOPATH/src/github.com/jamiefdhurst/journal
.
- Make sure the
$GOPATH/data
directory exists.
- Change directory to
$GOPATH/src/github.com/jamiefdhurst/journal
.
- Run
go get
to install dependencies
- Run
go build journal
to create the executable.
- Run
./journal
to load the application on port 3000. You should now be able
to fully access it at [](http://localhost:3000)
Installation and Setup (Docker method)
Please note: you will need Docker installed on your local machine.
Clone the repository to your chosen folder.
Build the container with docker build -t journal:latest .
Run the following to load the application and serve it on port 3000. You
should now be able to fully access it at [](http://localhost:3000)
docker run --rm -v ./data:/go/data -p 3000:3000 -it journal:latest
Options
-port=3000
- Use to set the port to serve on for HTTP, defaults to 3000.
Environment Variables
GIPHY_API_KEY
- Set to a GIPHY API key to use, or ignore to disable GIPHY.
To use the API key within your Docker setup, include it as follows:
docker run --rm -e GIPHY_API_KEY=... -v ./data:/go/data -p 3000:3000 -it journal:latest
Layout
The project layout follows the standard set out in the following document:
[](https://github.com/golang-standards/project-layout)
/api
- API documentation
/cmd/journal
- Main Journal executable folder
/internal/app/controller
- Controllers for the main application
/internal/app/model
- Models for the main application
/internal/app/router
- Implementation of router for given app
/pkg/adapter
- Adapters for connecting to external services
/pkg/controller
- Controller logic
/pkg/database
- Database connection logic
/pkg/router
- Router for handling services
/test
- API tests
/test/data
- Test data
/test/mocks
- Mock files for testing
/web/app
- CSS/JS source files
/web/static
- Compiled static public assets
/web/templates
- View templates