Setup basic project, runs on 8080 localhost

This commit is contained in:
2026-01-01 17:01:30 +00:00
parent 5abf978dbe
commit b407c1f722
9 changed files with 108 additions and 97 deletions

4
.gitignore vendored
View File

@@ -1,2 +1,6 @@
*~ *~
target/ target/
application.properties
.settings/
.project
.classpath

29
Makefile Normal file
View File

@@ -0,0 +1,29 @@
.PHONY: compile run clean verify test help
compile:
@echo "Compiling source files..."
mvn compile
run:
@echo "Running the application..."
mvn clean spring-boot:run
clean:
@echo "Cleaning build artifacts..."
mvn clean
verify:
@echo "Running tests and verifications..."
mvn verify
test:
@echo "Running tests..."
mvn test
help:
@echo "Available targets:"
@echo " make compile - Compile the source files"
@echo " make clean - Clean build artifacts"
@echo " make verify - Run tests and verifications"
@echo " make test - Run tests"
@echo " make help - Show this help message"

9
README.md Normal file
View File

@@ -0,0 +1,9 @@
# Introduction
This repository contains the source code and documentation for all of my APIs. It serves as a centralised location for my self-hosted services to use.
# Structure
The repository is organised into the following main directories:

97
pom.xml
View File

@@ -1,90 +1,51 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" <project xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>org.zaine.app</groupId> <groupId>org.zaine.app</groupId>
<artifactId>org-backend</artifactId> <artifactId>org-backend</artifactId>
<version>1.0-SNAPSHOT</version> <version>1.0.0-SNAPSHOT</version>
<name>org-backend</name> <name>org-backend</name>
<!-- FIXME change it to the project's website -->
<url>https://zainezq.com/api</url> <url>https://zainezq.com/api</url>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.2.1</version>
<relativePath/>
</parent>
<properties> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <java.version>17</java.version>
<maven.compiler.release>17</maven.compiler.release> <start-class>org.zaine.app.Application</start-class>
</properties> </properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.junit</groupId>
<artifactId>junit-bom</artifactId>
<version>5.11.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>org.junit.jupiter</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>junit-jupiter-api</artifactId> <artifactId>spring-boot-starter-web</artifactId>
<scope>test</scope>
</dependency> </dependency>
<!-- Optionally: parameterized tests support -->
<dependency> <dependency>
<groupId>org.junit.jupiter</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>junit-jupiter-params</artifactId> <artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
</dependencies> </dependencies>
<build> <build>
<pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) --> <plugins>
<plugins> <plugin>
<!-- clean lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#clean_Lifecycle --> <groupId>org.springframework.boot</groupId>
<plugin> <artifactId>spring-boot-maven-plugin</artifactId>
<artifactId>maven-clean-plugin</artifactId> </plugin>
<version>3.4.0</version>
</plugin> </plugins>
<!-- default lifecycle, jar packaging: see https://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_jar_packaging -->
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.3.1</version>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.13.0</version>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.3.0</version>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>3.4.2</version>
</plugin>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<version>3.1.2</version>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>3.1.2</version>
</plugin>
<!-- site lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#site_Lifecycle -->
<plugin>
<artifactId>maven-site-plugin</artifactId>
<version>3.12.1</version>
</plugin>
<plugin>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>3.6.1</version>
</plugin>
</plugins>
</pluginManagement>
</build> </build>
</project> </project>

View File

@@ -1,10 +0,0 @@
package org.zaine.app;
/**
* Hello world!
*/
public class App {
public static void main(String[] args) {
System.out.println("Hello World!");
}
}

View File

@@ -0,0 +1,13 @@
package org.zaine.app;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}

View File

@@ -0,0 +1,13 @@
package org.zaine.app;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class HealthController {
@GetMapping("/health")
public String health() {
return "OK";
}
}

View File

@@ -1,19 +0,0 @@
package org.zaine.app;
import static org.junit.jupiter.api.Assertions.assertTrue;
import org.junit.jupiter.api.Test;
/**
* Unit test for simple App.
*/
public class AppTest {
/**
* Rigorous Test :-)
*/
@Test
public void shouldAnswerWithTrue() {
assertTrue(true);
}
}

View File

@@ -0,0 +1,11 @@
package org.zaine.app;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.*;
import org.junit.jupiter.api.Test;
public class ApplicationTest {
}