简体   繁体   中英

POST and GET with Grunt ( GruntFile.js )

as you'll probably notice, I'am new to YEOMAN and 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 ). I'am trying to do something like POST and GET like express ( node.js ) does. 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 )

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

The 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.

If you want to fetch informations you can:

  • Put static JSON files in the web directory. (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. There is a few generator for it like this one: https://www.npmjs.org/package/generator-express

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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