/dap_msa

School Project : Google Email and Calendar API (Server)

Primary LanguageJavaApache License 2.0Apache-2.0

Data Access Project

  • Creation of a client-server application (you can find the client part in this repository : (https://github.com/Safiamoon/Client)) as part of "House Of Code"'s training.
  • This project uses Google APIs (GMAIL, CALENDAR) and will read unread emails, the list of labels in GMAIL, the next event in CALENDAR. It was built using Spring and Maven.

To use this Google API project :

API KEY

  • Create a folder Dap in your user.home
  • Go to https://console.developers.google.com, activate the GMAIL & GOOLE CALENDAR APIS
  • In API & Services, Identifiers, click on create identifiers OAuth CLientID, then choose web application
  • Select add a URI. You must then indicate the following URI: "http://localhost:8081/oAuth2Callback"
  • Finally click on save.
  • Then download this newly created identifier (on the identifier line on the far right)
  • Rename the download identifier as follows: 'credentials.json' and place it in the Dap folder (but not in the tokens folder)
  • You are normally good at starting the server.

Data Base

  • You can use whatever you want as a DB creation tool, in my case, I used MySql Workbench.
  • Create a DataBase schema with the name that you want.
  • In application.properties, you can add the following code (If you use MySql Workbench) :
# ===============================
# = DATA SOURCE
# ===============================

# Set here configurations for the database connection

# Connection url for the database "netgloo_blog"
spring.datasource.url = jdbc:mysql://localhost:[port of your DataBase]/[the name of your schema]

# Username and password
spring.datasource.username = [your username]
spring.datasource.password = [your password]

# ===============================
# = JPA / HIBERNATE
# ===============================

# Use spring.jpa.properties.* for Hibernate native properties (the prefix is
# stripped before adding them to the entity manager).

# Show or not log for each sql query
spring.jpa.show-sql = true

# Hibernate ddl auto (create, create-drop, update): with "update" the database
# schema will be automatically updated accordingly to java entities found in
# the project
spring.jpa.hibernate.ddl-auto = update

# Naming strategy
spring.jpa.hibernate.naming-strategy = org.hibernate.cfg.ImprovedNamingStrategy

# Allows Hibernate to generate SQL optimized for a particular DBMS
spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL5Dialect

server.port=[your server port]

The launch of the application

P.S :

  • Use your OWN server port (For me as an example, it was 8081)
  • Also, replace "suzy" by the name that you want.