- Go 53.7%
- HTML 34.9%
- CSS 8.8%
- Dockerfile 2.6%
|
natejank
800af4cbc5
Squashed commit of the following:
commit 568f61c20e9c61599bcbc38e5e8419000b9d5078 Author: natejank <njj3397@rit.edu> Date: Fri Jun 6 09:36:39 2025 -0400 look good commit 27fbe13d0a629632438576f911347ae4204f813c Author: natejank <njj3397@rit.edu> Date: Fri Jun 6 09:21:45 2025 -0400 remove color from stylesheet i am not good at making css look good, but the browser is |
||
|---|---|---|
| dist | also serve modernize css locally | |
| pinboard | [backend] return submitted pin in /new | |
| .gitignore | refactor data storage | |
| Dockerfile | [Docker] store database in alternate location for volumes | |
| favicon.ico | add favicon | |
| go.mod | refactor data storage | |
| go.sum | store and retrieve posts to sqlite | |
| icon.png | add icon to readme | |
| index.html | Squashed commit of the following: | |
| LICENSE | readme and license | |
| README.md | [Docker] store database in alternate location for volumes | |
| router.go | also serve modernize css locally | |
| style.css | Squashed commit of the following: | |
Pinboard
A quick & dirty private pinboard to keep track of little bits of text. Allows you to title and categorize submissions.
Features
- Create pins
- Edit pins
- Delete pins
- Frontend
- Basic frontend for viewing and submitting pins
- Dynamic frontend with a stylesheet
- Ability to set a pin title
- Ability to select type of new pin
- Ability to sort pins by type
- Ability to search for pins
- Backend
- Search for pins
- Delete pins
- Edit pins
- Query pins by parameters
- Timestamp new pins
- Deployment options
- Set a port/listening address
- Configure a database location
Building
This project uses the standard go build system. This includes pre-build steps to download frontend libraries to avoid using a CDN. There is no frontend build step. You can also use docker if you prefer :)
Docker
docker build -t pinboard:latest .
This serves HTTP on port 8080. The database is stored in /data/pins.db, which
should be mounted in a volume for persistence.
Manual
go generate
go run router.go # or go build router.go -o server
Security
Although this application tries to follow best practices, it doesn't include any kind of authentication and only minimally vets user input. If you choose to deploy this, place it behind a firewall such as Tailscale.
Stack
- Go
- SQLite
- Preact
Schema
/new
- Method:
POST - Submit a new pin
Request Body
{
"id": 0, // this value should be supplied, but is not considered by the backend
"title": "pin_title",
"value": "pin_content",
"type": "string_type",
}
Response Body
Returns the populated pin as accepted by the backend
{
"id": 999, // id of the pin
"title": "pin_title",
"value": "pin_content",
"type": "string_type",
},
/edit
- Method:
PUT - Update the value of a pin
Request Body
{
"id": 999, // id of the pin to update
"title": "pin_title",
"value": "pin_content",
"type": "string_type",
}
Response
OK if id corresponded to a pin, otherwise NOT FOUND.
/pins
- Method:
GET - Returns an array containing every pin
Request Body
None.
Response Body
[
{
"id": 999, // id of the pin
"title": "pin_title",
"value": "pin_content",
"type": "string_type",
},
]
/types
- Method:
GET - Returns the accepted types of pins
Request Body
None
Response Body
[
"type name",
"type name",
]
/delete
- Method:
DELETE - Deletes a pin
Request Body
n/a
Query Parameters
?id=999- id of pin to delete
Response
OK if the pin was deleted. NOT FOUND if pin does not exist.