How to run grunt server in dist directory instead of app directory?

前端 未结 4 987
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-13 18:26

After grunt building my AngularJS app to my dist directory, I would like to test it out with grunt server. Problem is that grunt

4条回答
  •  無奈伤痛
    2020-12-13 18:52

    Although other have not advised doing this, I believe this is what you are looking for. I do something like this in my server.js file when using express.

    if (process.env.NODE_ENV == 'production') {
        app.use(express.static('/dist'));
    }else{
        app.use(express.static('/app'));       
    }
    

    Hope this helps!

提交回复
热议问题