Skip to content

Commit c712fe7

Browse files
committed
add readme.md and contrubuting.md
1 parent de9d749 commit c712fe7

File tree

2 files changed

+147
-0
lines changed

2 files changed

+147
-0
lines changed

CONTRIBUTING.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Contributing to GoShortURL
2+
3+
Thank you for your interest in contributing to GoShortURL! By participating in this project, you agree to abide by the [Code of Conduct](CODE_OF_CONDUCT.md).
4+
5+
## How to Contribute
6+
7+
We welcome contributions from the community, whether they come in the form of bug reports, feature requests, discussions, or pull requests. Please follow these guidelines to contribute effectively.
8+
9+
### Issues
10+
11+
- For bug reports and feature requests, please use the GitHub [issue tracker](https://github.com/daniwebdev/go-short-url/issues).
12+
- Clearly describe the problem or enhancement you're addressing.
13+
- Provide steps to reproduce the issue if it's a bug.
14+
- If suggesting a new feature, explain its use case and potential benefits.
15+
16+
### Pull Requests
17+
18+
1. Fork the repository and create a new branch for your contribution.
19+
2. Follow the coding style and conventions used in the project.
20+
3. Write clear and concise commit messages.
21+
4. Provide tests for new features or bug fixes.
22+
5. Ensure your changes don't break existing functionality.
23+
6. If your pull request relates to an open issue, reference the issue in your pull request.
24+
25+
### Coding Standards
26+
27+
- Adhere to the existing coding style in the project.
28+
- Use meaningful variable and function names.
29+
- Comment your code where necessary to enhance readability.
30+
31+
### Commit Message Guidelines
32+
33+
Follow the conventional commits specification for your commit messages. See [Conventional Commits](https://www.conventionalcommits.org/) for more details.
34+
35+
### License
36+
37+
By contributing to this project, you agree that your contributions will be licensed under the project's [LICENSE](LICENSE).
38+
39+
## Code of Conduct
40+
41+
Please read our [Code of Conduct](CODE_OF_CONDUCT.md) before participating in this project.
42+
43+
## Contact
44+
45+
If you have any questions or need further clarification, please [contact us](mailto:your-email@example.com).
46+
47+
Happy coding!

README.md

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
# GoShortURL- Open Source URL Shortener
2+
3+
GoShortURL is a powerful and flexible open-source URL shortener built with Go (Golang) and SQLite. It provides a simple and efficient way to create and manage short URLs, making it easy to share links and track their usage.
4+
5+
## Features
6+
7+
- **Custom Short URLs**: Create custom short URLs with ease.
8+
- **Metadata Scraping**: Automatically fetches metadata (title, description, image) from the target URL.
9+
- **Analytics**: Track the number of visits and last visit timestamp for each short URL.
10+
- **Pagination**: Easily navigate through your list of short URLs with paginated results.
11+
- **Secure**: Built with security in mind, ensuring reliable and safe URL shortening.
12+
13+
## Getting Started
14+
15+
### Prerequisites
16+
17+
Ensure you have the following prerequisites installed before setting up and running the URL shortener:
18+
19+
- Go (Golang)
20+
- SQLite
21+
- Additional Go libraries (dependencies):
22+
- [github.com/PuerkitoBio/goquery v1.8.1](https://pkg.go.dev/github.com/PuerkitoBio/goquery)
23+
- [github.com/andybalholm/cascadia v1.3.2](https://pkg.go.dev/github.com/andybalholm/cascadia)
24+
- [github.com/gorilla/mux v1.8.1](https://pkg.go.dev/github.com/gorilla/mux)
25+
- [github.com/mattn/go-sqlite3 v1.14.19](https://pkg.go.dev/github.com/mattn/go-sqlite3)
26+
- [golang.org/x/net v0.19.0](https://pkg.go.dev/golang.org/x/net)
27+
28+
You can install these dependencies using the `go get` command, for example:
29+
30+
```bash
31+
go get -u github.com/PuerkitoBio/goquery@v1.8.1
32+
go get -u github.com/andybalholm/cascadia@v1.3.2
33+
go get -u github.com/gorilla/mux@v1.8.1
34+
go get -u github.com/mattn/go-sqlite3@v1.14.19
35+
go get -u golang.org/x/net@v0.19.0
36+
```
37+
38+
This ensures all required libraries are installed for the URL shortener project.
39+
40+
Feel free to adjust the wording or formatting based on your preferences.
41+
42+
### Installation
43+
44+
Clone the repository:
45+
46+
```bash
47+
git clone https://github.com/daniwebdev/go-short-url.git
48+
cd go-short-url
49+
```
50+
51+
Build and run the project:
52+
53+
```bash
54+
GO_SHORT_KEY=your_api_key go run main.go
55+
```
56+
57+
By default, the server will start on port `8080`. You can customize the port using the `-port` flag.
58+
59+
### Usage
60+
61+
#### Creating a Short URL
62+
63+
To create a short URL, send a POST request to the `/api` endpoint with a JSON payload:
64+
65+
```bash
66+
curl -X POST http://localhost:8080/api -H "Content-Type: application/json" -H "X-API-Key: your_api_key" -d '{
67+
"url": "https://example.com",
68+
"custom_id": "custom_short_id",
69+
}'
70+
```
71+
72+
When creating a short URL, the metadata will be scraped from the provided URL, including title, description, and images, to enhance the information associated with the short URL. This ensures a richer preview when the short URL is accessed.
73+
74+
Feel free to customize the wording or provide additional details as needed.
75+
76+
#### Retrieving Short URLs
77+
78+
To get a list of short URLs with pagination, send a GET request to the `/api/{space}` endpoint:
79+
80+
```bash
81+
curl http://localhost:8080/api/{space}?page=1&perPage=10 -H "Content-Type: application/json" -H "X-API-Key: your_api_key"
82+
```
83+
84+
For more details on API endpoints, refer to the [API Rest](api.rest).
85+
86+
## Contributing
87+
88+
Contributions are welcome! Please check out our [Contribution Guidelines](CONTRIBUTING.md) for more details.
89+
90+
## License
91+
92+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
93+
94+
## Acknowledgments
95+
96+
- [Gorilla Mux](https://github.com/gorilla/mux) for the powerful router.
97+
- [goquery](https://github.com/PuerkitoBio/goquery) - A great library for working with HTML documents using jQuery-style syntax.
98+
- [cascadia](https://github.com/andybalholm/cascadia) - A CSS selector library for Go.
99+
- [go-sqlite3](https://github.com/mattn/go-sqlite3) - SQLite driver for Go, ensuring seamless database operations.
100+
- [golang.org/x/net](https://pkg.go.dev/golang.org/x/net) - The Go networking libraries providing support for various protocols.

0 commit comments

Comments
 (0)