RootApi.java

package fr.metabocloud.core.api;

import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import fr.metabocloud.core.model.InfoMessages;

/**
 * Controller for the root of the REST API "/"
 *
 * @author Faustine Souc
 * @since 1.0.0
 */

@CrossOrigin(origins = "*", maxAge = 3600)
@RestController
public class RootApi {

	/**
	 * Protected constructor
	 */
	protected RootApi() {
	}
	
	/**
	 * Handle GET requests to the root `/` endpoint.
	 * Return a message at the application root to redirect to the OpenAPI
	 * documentation.
	 *
	 * @return The message with the link of the OpenAPI documentation
	 */
	@GetMapping(value = "/")
	public ResponseEntity<String> getRoot() {
		return ResponseEntity.ok(InfoMessages.ROOT.label);
	}
}