Home > AI > Backend > SpringBoot >

add prefix for REST API

Add this code snippet to application.yml

server:
  servlet:
    context-path: /api/v1
    encoding:
      force: true
      charset: UTF-8

Then each endpoint will fall behind the /api/v1 prefix

Also, you Swagger documentation address changes to

http://localhost:8081/api/v1/swagger-ui.html#/

Leave a Reply