简体   繁体   English

使用Grunt(GruntFile.js)进行POST和GET

[英]POST and GET with Grunt ( GruntFile.js )

as you'll probably notice, I'am new to YEOMAN and GRUNT. 您可能会注意到,我是YEOMAN和GRUNT的新手。 I have recently installed "yeoman angular generator" and I'am having trouble passing data between the grunt server ( gruntfile.js ) and web pages ( index.html ). 我最近安装了“ yeoman角度生成器”,无法在grunt服务器(gruntfile.js)和网页(index.html)之间传递数据。 I'am trying to do something like POST and GET like express ( node.js ) does. 我正在尝试像Express(node.js)一样执行POST和GET的操作。 Basically all I want to do is to send some variables from client side ( HTML ) to server ( Grunt ) and to be able to recieve data ( variables , JSON, HTML ) 基本上,我要做的就是将一些变量从客户端(HTML)发送到服务器(Grunt)并能够接收数据(变量,JSON,HTML)

The Angular Generator : https://github.com/yeoman/generator-angular Angular生成器: https : //github.com/yeoman/generator-angular

The gruntfile.js : http://www.filetolink.com/293e57448f gruntfile.js: http//www.filetolink.com/293e57448f

I am pretty sure that the yeoman angular generator only create a simple static website with no server side ability. 我非常确定yeoman angular generator只能创建一个没有服务器端功能的简单静态网站。

If you want to fetch informations you can: 如果要获取信息,可以:

  • Put static JSON files in the web directory. 将静态JSON文件放入Web目录。 (If you don't need server side processing) (如果不需要服务器端处理)
  • Build you a little server 为您搭建一个小服务器

For the second solution you can continue to use yeoman if you like. 对于第二种解决方案,您可以根据需要继续使用yeoman There is a few generator for it like this one: https://www.npmjs.org/package/generator-express 有一些类似这样的生成器: https : //www.npmjs.org/package/generator-express

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM