微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

在运行应用程序中的angularjs – Grails 3.0静态html

之前曾经提到类似的问题,关于grails 2(.3,.4).我觉得很奇怪,我找不到一个办法,因为它似乎是一个标准的用例.

当我运行grails运行应用程序时,我只想提供html页面,包括它们链接的.css和.js(有角度和jQuery的内容).

我想检查我的http呼叫是否在双方正确使用 – 无需部署.war并配置数据库.

afaik grails run-app只是启动一个jetty / tomcat – 这两个都可以显着地提供.html页面.我需要做什么来使grails开发工具部署我的文件

我需要发出http请求,
所以使用不同的服务器会违反JS-SOP,
而部署.war会大大减缓开发过程

我迄今为止只发现了笨重的jsonp,代理,.war部署解决方案或者解决方

我尝试将文件放在项目的结构(/ src / main,/ src / main / resources,/ src / main / public,资产文件夹及其子文件夹)中,在每个子目录中创建了Web应用程序目录,Init,domain,conf目录 – 你命名)

将index.html添加到src / main / resources / public

然后将其添加urlmappings.groovy中:

"/"(redirect:"/index.html")

对于grails> = 3.0.12

Location of static resources

In order to resolve an issue around how POST requests are treated for
REST applications on non-existent resources,static resources located
in src/main/resources/public are Now resolved under the /static/** URI
by default,instead of the base URI /**. If you wish to restore the
prevIoUs behavIoUr add the following configuration:

grails.resources.pattern = ‘/**’

https://github.com/grails/grails-core/releases/tag/v3.0.12

原文地址:https://www.jb51.cc/angularjs/140813.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐