Skip to content
Snippets Groups Projects
README.md 3.05 KiB
Newer Older
BEAUVAIS ANTOINE's avatar
BEAUVAIS ANTOINE committed
# BACK
## 2021-2022 SIL ERP solution

This is the BACK component for the 2021-2022 M2 SIL version 
of the ERP system, a project for the ERP subject.

This work is licensed under the [CeCILL-B license agreement](https://cecill.info/licences/Licence_CeCILL-B_V1-en.html).  

### What's this?

BACK is the component that handles financial documentation 
as well as a Stock Management system for the articles for sale. 
It also provides other components information about the available 
products such as the number of each article in stock as well as their 
price.

[Documentation Home](https://erp-sil.pages.unistra.fr/back/)

The RESTful API is documented through an OpenAPI specification file that you can
view [here](https://erp-sil.pages.unistra.fr/back/openapi/index.html).

The project's Javadoc is automatically generated through CI for each commit
on the `master` branch and can be found [here](https://erp-sil.pages.unistra.fr/back/javadoc/index.html).
BEAUVAIS ANTOINE's avatar
BEAUVAIS ANTOINE committed
### Running

BACK is a [Java Spring](https://spring.io/) Web application built using 
the [Gradle Build Tool](https://gradle.org/). It uses [Thymeleaf](https://www.thymeleaf.org) 
for Web templates.
BEAUVAIS ANTOINE's avatar
BEAUVAIS ANTOINE committed

Gradle allows you to quickly test the application by running a local 
test [Apache TomCat](https://tomcat.apache.org/) server that hosts 
the application. It also allows you to quickly build a WAR archive 
for deployment on a production Apache TomCat or [Eclipse Glassfish](https://glassfish.org/) 
server.
BEAUVAIS ANTOINE's avatar
BEAUVAIS ANTOINE committed

It is recommended to use a Java IDE to run and deploy the application.

* [JetBrains IntelliJ IDEA](https://www.jetbrains.com/idea/) (proprietary, requires a license)
* [Apache NetBeans](https://netbeans.apache.org/) (free and open-source)
* [Eclipse IDE for Java Developers](https://www.eclipse.org/downloads/packages/) (free and open-source)

Make sure you have a Java Development Kit version **8 or later** installed on your machine.
You must have the full JDK to build the program. You can deploy the WAR file on a machine 
with the JRE only.

First, make sure you create an API key for the application.

In `src/main/resources`, create a new `apikey.properties` file that contains:

```
api.key=MyApiKey
```

#### Building and running

You can build and run the project using the following command on UNIX-based systems:

```
./gradlew bootRun
```

On Microsoft Windows, use:

```
.\gradlew bootRun
```

When running, you can reach the application at [http://127.0.0.1:8080/](http://127.0.0.1:8080/).

To stop it, you should be able to use the CTRL+C keyboard shortcut. Otherwise, run another terminal 
in the project folder and use:

```
./gradlew stop
```
or, on Microsoft Windows,
```
.\gradlew stop
### Calling the API

You can view the documentation [here](https://erp-sil.pages.unistra.fr/back/openapi/index.html).

Use [Postman](https://www.postman.com/) or [Advanced REST Client](https://install.advancedrestclient.com/install) to make calls to the RESTful API.

Note that all calls to the API must specify the API key configured in the 
application's `apikey.properties` file in the `apikey` HTTP header.