first implementation - image/drawing integration
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
package com.aiteacher.config;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
|
||||
import java.nio.file.Paths;
|
||||
|
||||
@Configuration
|
||||
public class FigureStorageConfig implements WebMvcConfigurer {
|
||||
|
||||
private final String basePath;
|
||||
|
||||
public FigureStorageConfig(@Value("${app.figure-storage.base-path:./uploads}") String basePath) {
|
||||
this.basePath = Paths.get(basePath).toAbsolutePath().normalize().toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
||||
// Serve GET /api/v1/figures/** from the local file store
|
||||
registry.addResourceHandler("/api/v1/figures/**")
|
||||
.addResourceLocations("file:" + basePath + "/figures/");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user