Skip to content

A web application built with Spring Boot, Spring Data and Thymeleaf.

Notifications You must be signed in to change notification settings

douglasdotv/code-sharing-platform

Repository files navigation

code-sharing-platform

en pt-br

About

This is a web application that allows users to share code snippets with each other.

Example 1: Screenshot 1 Screenshot 2

Example 2: Screenshot 3

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 page
  • POST /api/code/new - Save a new code snippet
  • GET /code/{id} - Access a code snippet page
  • GET /api/code/{id} - Get a code snippet in JSON format
  • GET /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

Project stages

Stages
  1. Show the code!
  2. POST updates
  3. Snippets feed
  4. Work with the database
  5. Super secret snippets

Technologies used

  • Java 17
  • Gradle
  • Spring Boot 2.5.6
  • Spring MVC
  • Spring Data JPA
  • H2 Database
  • Thymeleaf
  • highlight.js
  • Bootstrap

Skills developed throughout the project

  • 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

How to run the project

  1. 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.

  2. Open a terminal and clone the repository:

git clone https://github.com/douglasdotv/code-sharing-platform.git
  1. Navigate to the project folder:
cd code-sharing-platform
  1. Build and run the application
./gradlew build
./gradlew bootRun
  1. 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)

Contact

If you have any questions or suggestions, feel free to contact me via LinkedIn or via email ([email protected]).