The CI/CD Badges for Build Success and Percentage of Lines of code Coverage for Tests were created using using Github Actions
- As a user I should be able to create a Pastebin
- As a user I should be able to share the Pastebin with a unique URL
- Once the pastebin is created, it cannot be modified
- As a user I should be able to login
- No password to the pastebin
- How long is it going to stay up on the website? 90 days. User should be able to set a custom time on the pastebin
- All the content in pastebin is Text only.
- Is there a character limit? Maximum words is 1000 words.
Retrieves a list of all users
Retrieves a list of all pastebins
Retrieves a specific user by ID
Retrieves a specific pastebin by ID
Retrieves all pastebins created by a specific user
Creates a new user
Creates a new pastebin
Retrieves a list of all pastebins
Example response:
[
{
"id": 1,
"content": "Lorem Ipsum",
"user_id": 1
},
{
"id": 2,
"content": "Dolor sit amet",
"user_id": 2
}
]
Retrieves a specific user by ID
Example request: GET /api/v1/user/1
Example response:
{
"id": 1,
"name": "John Doe",
"email": "johndoe@example.com",
"pastebins": [1, 2]
}
Retrieves a specific pastebin by ID
Example request: GET /api/v1/pastebin/1
Example response:
{
"id": 1,
"content": "Lorem Ipsum",
"user_id": 1
}
Retrieves all pastebins created by a specific user
Example request: GET /api/v1/pastebins/user/1
Example response:
[
{
"id": 1,
"content": "Lorem Ipsum",
"user_id": 1
},
{
"id": 2,
"content": "Dolor sit amet",
"user_id": 1
}
]
Create a new user
Example request:
{
"name": "John Doe",
"email": "johndoe@example.com"
}
Example response
{
"id": 1,
"name": "John Doe",
"email": "johndoe@example.com",
"pastebins": []
}
Create a new pastebin
Example request:
{
"content": "Lorem Ipsum",
"user_id": 1
}
Example Response:
{
"id": 1,
"content": "Lorem Ipsum",
"user_id": 1
}
- "id" SERIAL PRIMARY KEY
- "name" varchar
- "email" varchar
- "password" varchar
- "created_at" timestamp DEFAULT CURRENT_TIMESTAMP
- "updated_at" timestamp DEFAULT CURRENT_TIMESTAMP
- "id" SERIAL PRIMARY KEY
- "content" varchar
- "user_id" int
- "password" varchar
- "created_at" timestamp DEFAULT CURRENT_TIMESTAMP
- "updated_at" timestamp DEFAULT CURRENT_TIMESTAMP
go mod tidy
go build ./cmd/web
go build ./...
go run ./cmd/web
go test -v ./internal/datasource
go test -v ./internal/datasource
go test -v ./...
psql -U postgres -h localhost postgres