This is a web application that allows users to share code snippets with each other.
The user can write code, set an expiration date and/or a maximum number of views for it, and then share the code snippet link with others.
Both time and views restrictions are optional.
If they are set, the snippet will be private and available until a restriction is reached (it is deleted from the database after that).
On the other hand, if none of them are set, the snippet will be public and available forever.
(Negative or null values and the number 0 for the time
and views
fields are interpreted as an absence of a restriction. Positive values are interpreted as a restriction.)
Available endpoints:
GET /code/new
- Create a new code snippet pagePOST /api/code/new
- Save a new code snippetGET /code/{id}
- Access a code snippet pageGET /api/code/{id}
- Get a code snippet in JSON formatGET /code/latest
- Access the latest public code snippets (code snippets without time or views restriction)GET /api/code/latest
- Get the latest public code snippets (code snippets without time or views restriction) in JSON format
- Java 17
- Gradle
- Spring Boot 2.5.6
- Spring MVC
- Spring Data JPA
- H2 Database
- Thymeleaf
- highlight.js
- Bootstrap
- How to use Spring Boot and Spring MVC to create a web application
- How to use Spring Data JPA and H2 to work with a database
- How to use Thymeleaf to create a web page
- How to use highlight.js to highlight code snippets
- How to use Bootstrap to style a web page
-
Make sure that you have JDK (Java Development Kit) and JRE (Java Runtime Environment) installed on your computer and that you're connected to the Internet.
-
Open a terminal and clone the repository:
git clone https://github.com/douglasdotv/code-sharing-platform.git
- Navigate to the project folder:
cd code-sharing-platform
- Build and run the application
./gradlew build
./gradlew bootRun
- Access the application endpoints using a browser or a client like Postman or Insomnia.
(The application will run on port 8889 by default.)
(Example: http://localhost:8889/code/new)
If you have any questions or suggestions, feel free to contact me via LinkedIn or via email (douglas16722@gmail.com).