backend configurado

This commit is contained in:
Soka_jplr 2024-04-18 09:44:13 -06:00
parent 99b3c4eabb
commit 613e08c53f
2 changed files with 76 additions and 46 deletions

View File

@ -14,8 +14,8 @@
<properties> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.7</maven.compiler.source> <maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target> <maven.compiler.target>1.8</maven.compiler.target>
</properties> </properties>
<dependencies> <dependencies>
@ -25,51 +25,66 @@
<version>4.11</version> <version>4.11</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency>
<groupId>com.sparkjava</groupId>
<artifactId>spark-core</artifactId>
<version>2.9.4</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.7.21</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.10.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.30</version>
</dependency>
</dependencies> </dependencies>
<build> <build>
<pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) -->
<plugins> <plugins>
<!-- clean lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#clean_Lifecycle -->
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>3.1.0</version>
</plugin>
<!-- 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.0.2</version>
</plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId> <artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version> <version>2.3.2</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin> </plugin>
<plugin> <plugin>
<artifactId>maven-surefire-plugin</artifactId> <artifactId>maven-assembly-plugin</artifactId>
<version>2.22.1</version> <executions>
</plugin> <execution>
<plugin> <phase>package</phase>
<artifactId>maven-jar-plugin</artifactId> <goals>
<version>3.0.2</version> <goal>single</goal>
</plugin> </goals>
<plugin> </execution>
<artifactId>maven-install-plugin</artifactId> </executions>
<version>2.5.2</version> <configuration>
</plugin> <descriptorRefs>
<plugin> <!-- This tells Maven to include all dependencies -->
<artifactId>maven-deploy-plugin</artifactId> <descriptorRef>jar-with-dependencies</descriptorRef>
<version>2.8.2</version> </descriptorRefs>
</plugin> <archive>
<!-- site lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#site_Lifecycle --> <manifest>
<plugin> <mainClass>mx.uv.App</mainClass>
<artifactId>maven-site-plugin</artifactId> </manifest>
<version>3.7.1</version> </archive>
</plugin> </configuration>
<plugin>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>3.0.0</version>
</plugin> </plugin>
</plugins> </plugins>
</pluginManagement>
</build> </build>
</project> </project>

View File

@ -1,13 +1,28 @@
package mx.uv; package mx.uv;
import static spark.Spark.*;
/** import java.util.HashMap;
* Hello world! import java.util.UUID;
*
*/ import com.google.gson.*;
public class App public class App
{ {
public static void main( String[] args ) public static void main( String[] args )
{ {
System.out.println( "Hello World!" ); System.out.println( "Hello World!" );
//port(80);
get("/usuarios", (request, response) ->{
response.type("application/json");
JsonObject respuesta = new JsonObject();
respuesta.addProperty("msj", "");
return respuesta;
});
post("/usuarios", (request, response) ->{
String payload = request.body();
JsonObject respuesta = new JsonObject();
respuesta.addProperty("msj", "");
return respuesta;
});
} }
} }