Newer
Older
# 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
The RESTful API is documented through an OpenAPI specification file that you can
open through [SwaggerHub](https://editor.swagger.io/).
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/).
### Running
BACK is a [Java Spring](https://spring.io/) Web application built using
the [Gradle Build Tool](https://gradle.org/).
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 [Oracle Glassfish](https://www.oracle.com/middleware/technologies/glassfish-server.html) server.
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,
```
Go to [SwaggerHub](https://editor.swagger.io/) to open the `back-openapi.yaml` file, which is
an OpenAPI specification document.
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.