RandilaP / scholarx

The backend of the ScholarX project

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ScholarX - backend application and auth server

Backend of the ScholarX project

Setting up the project for development

Prerequisites

  • Java
  • Maven
  • PostgreSQL
  • Linkedin Social Login App
  • Gmail Account with an App Password

Setup Linkedin Social Login App

  1. Create a new Linkedin App (help?)
  2. Click on Auth tab and add http://localhost:8080/login/oauth2/code/linkedin as an authorised redirect URL
  3. Make Sure you have properly added the Sign in with Linkedin product under products tab

Setup a gmail account with an app password

  1. Create a new gmail account if you don't have one already
  2. Enable Two Factor Authorisation
  3. Generate a new App Password (help?)

Run Locally

  1. Fork and clone the repository
git clone https://github.com/<your profile name>/scholarx
  1. Open the cloned repo, Find and open the application.yml file
  2. Replace the ${client-id} and ${client-secret} with the values from the above linkedin social app
    example:
          linkedin:
            client-id: 324780jdsfg2u4
            client-secret: MsdfsdfggsqPFh
            client-authentication-method: post
            authorization-grant-type: authorization_code
  1. Replace the mail username and password values with the generated App Password and the corresponding gmail address
    example:
  mail:
    host: smtp.gmail.com
    port: 587
    username: samplemail@gmail.com
    password: jhdfklsdjjadskt
    properties:
  1. Replace the datasource dummy values with your local mysql server instance credentials
    example:
  datasource:
    url: jdbc:postgresql://localhost:5432/scholarx_DB?allowPublicKeyRetrieval=true&useSSL=false&useUnicode=true&characterEncoding=UTF-8
    username: rootuser
    password: rootpassword
    platform: postgres
  1. Run the application
mvn spring-boot:run

Configuring a MySQL Database (Optional)

  1. Add the mysql-connector-java dependency to the pom.xml file.
<dependency>
  <groupId>mysql</groupId>
  <artifactId>mysql-connector-java</artifactId>
  <scope>runtime</scope>
</dependency>
  1. Replace the spring.jpa and spring.datasource configurations in application.yml with the following configuration.
  jpa:
    database: postgresql
    hibernate:
      ddl-auto: update
  datasource:
    url: jdbc:postgresql://${DB_URL}/${DB_NAME}?allowPublicKeyRetrieval=true&useSSL=false&useUnicode=true&characterEncoding=UTF-8
    username: ${DB_USER_NAME}
    password: ${DB_USER_PASSWORD}
    platform: postgres

About

The backend of the ScholarX project

License:MIT License


Languages

Language:Java 96.5%Language:HTML 3.5%Language:Procfile 0.0%