升级到:Grails 3.3.2,设置服务器URL

时间:2018-02-21 12:41:08

标签: grails upgrade grails-3.3

您好我将现有的Grails 2.4.5升级到Grails 3.3.2。我跟着https://docs.grails.org/3.0.x/guide/upgrading.html。 Grails应用程序在localhost:8080运行,但我希望服务器URL为http://localhost:8080/projectName。我尝试将以下内容添加到application.yml:

environments:
   development:
     grails:
       serverURL: http://localhost:8080/projectName

URLMappings.groovy如下所示:

"/"(view:"/index")
"500"(view:'/error')
"404"(view:'/notFound')

我做错了什么?

1 个答案:

答案 0 :(得分:0)

添加 server.contextPath

@Injectable()
export class AuthenticationGuard implements CanActivate {

    constructor(
        private router: Router,
        private authService: AuthService) { }

    canActivate(
        route: ActivatedRouteSnapshot,
        state: RouterStateSnapshot
    ): Observable<boolean> | Promise<boolean> | boolean {

        // Auth checking code here

        // Make sure you return true here if you want to show child routes
        return true;
    }
}