diff --git a/backend/pom.xml b/backend/pom.xml new file mode 100644 index 0000000..1576d4b --- /dev/null +++ b/backend/pom.xml @@ -0,0 +1,90 @@ + + + 4.0.0 + + org.springframework.boot + spring-boot-starter-parent + 3.4.1 + + + com.rit + portal + 0.0.1-SNAPSHOT + Freshers Hub Backend + Centralized Spring Boot backend for RIT Freshers Hub + + + + + + + + + + + + + + + 21 + + + + + org.springframework.boot + spring-boot-starter-web + + + + + org.springframework.boot + spring-boot-starter-data-jpa + + + + + org.postgresql + postgresql + runtime + + + + + org.projectlombok + lombok + true + + + + + org.springframework.boot + spring-boot-starter-validation + + + + + org.springframework.boot + spring-boot-starter-test + test + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + org.projectlombok + lombok + + + + + + + + diff --git a/backend/src/main/java/com/rit/portal/PortalApplication.java b/backend/src/main/java/com/rit/portal/PortalApplication.java new file mode 100644 index 0000000..30b334c --- /dev/null +++ b/backend/src/main/java/com/rit/portal/PortalApplication.java @@ -0,0 +1,13 @@ +package com.rit.portal; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class PortalApplication { + + public static void main(String[] args) { + SpringApplication.run(PortalApplication.class, args); + } + +} diff --git a/backend/src/main/java/com/rit/portal/config/WebConfig.java b/backend/src/main/java/com/rit/portal/config/WebConfig.java new file mode 100644 index 0000000..680bdc3 --- /dev/null +++ b/backend/src/main/java/com/rit/portal/config/WebConfig.java @@ -0,0 +1,18 @@ +package com.rit.portal.config; + +import org.springframework.context.annotation.Configuration; +import org.springframework.web.servlet.config.annotation.CorsRegistry; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; + +@Configuration +public class WebConfig implements WebMvcConfigurer { + + @Override + public void addCorsMappings(CorsRegistry registry) { + registry.addMapping("/api/**") + .allowedOrigins("http://localhost:5173", "http://localhost:3000") + .allowedMethods("GET", "POST", "PUT", "DELETE", "OPTIONS") + .allowedHeaders("*") + .allowCredentials(true); + } +} diff --git a/backend/src/main/resources/application.properties b/backend/src/main/resources/application.properties new file mode 100644 index 0000000..2599148 --- /dev/null +++ b/backend/src/main/resources/application.properties @@ -0,0 +1,13 @@ +# ─── DATABASE CONNECTION CONFIGURATION ─── +spring.datasource.url=jdbc:postgresql://localhost:5432/rit_freshers_hub?sslmode=disable +spring.datasource.username=postgres +spring.datasource.password=your_local_postgres_password_here + +# ─── JPA / HIBERNATE SETTINGS ─── +spring.jpa.database-platform=org.hibernate.dialect.PostgreSQLDialect +spring.jpa.hibernate.ddl-auto=validate +spring.jpa.show-sql=true +spring.jpa.properties.hibernate.format_sql=true + +# ─── SERVER PORT ─── +server.port=8080