我想用Vue构建一个单页应用程序.js使用Nginx作为我的Web服务器和我自己的Dropwiward REST API.此外,我使用Axios调用我的REST请求.
我的nginx配置看起来像
server {
listen 80;
server_name localhost;
location / {
root path/to/vue.js/Project;
index index.html index.htm;
include /etc/nginx/mime.types;
}
location /api/ {
rewrite ^/api^/ /$1 break;
proxy_pass http://localhost:8080/;
}
}
目前我只需拨打我的localhost/api/path/to/rescource
就可以从后端获取信息.
我用HTML和javascript(vue.js)构建了前端,这到目前为止已经奏效了.然而,当我想要构建一个单页应用程序时,大多数教程都会提到 node .js.如何使用Nginx?