小编kgc*_*usi的帖子

Laravel Blade 更漂亮的格式,但删除了语法突出显示和片段

*.blade.php在 中添加了 html 以files.associations使我的文件具有更漂亮的格式blade.php,但这会导致删除文件中所需的片段和突出显示blade.php。我使用 Prettier 进行格式化,使用 Laravel Blade Snippets 进行突出显示和片段。有没有其他方法将 Blade 文件格式化为 html 但保留片段和突出显示?

*.blade.phpfiles.associations 在此输入图像描述

没有*.blade.phpfiles.associations 在此输入图像描述

php laravel visual-studio-code prettier

6
推荐指数
1
解决办法
6182
查看次数

Mongoose 按createdAt排序

我的 Post 控制器上有一个 getPosts 控制器,我的目标是按 创建时间对其进行排序以保持顺序,因为当我将其映射到前端时,它从最后创建的开始到最新创建的。

const getPosts = asyncHandler(async (req, res) => {
  const posts = await Post.find().sort([createdAt, 1]);
  res.json(posts);
});
Run Code Online (Sandbox Code Playgroud)

javascript mongoose mongodb express

3
推荐指数
1
解决办法
7441
查看次数

Nginx 代理将 Nodejs 传递给 React 应用程序

我有一个反应前端和节点后端,由于某种原因它不会向后端发出正确的请求。

nginx给出的错误日志

111: Connection refused) while connecting to upstream, server: _, request: "GET /api/info HTTP/1.1", upstream: "http://127.0.0.1:5000/info"
Run Code Online (Sandbox Code Playgroud)

我注意到它提出了错误的请求,因为http://127.0.0.1:5000/info应该是http://127.0.0.1:5000/api/info

我的默认配置

server {
        listen 80 default_server;
        listen [::]:80 default_server;

        root /var/www/{{AppName}}/frontend/build;

        server_name {{myDomainName}};

        location / {
                try_files $uri $uri/ =404;
        }

        location /api/ {
                proxy_pass http://localhost:5000/;
        }
Run Code Online (Sandbox Code Playgroud)

当我访问我的网站时,它只是显示错误 404

nginx amazon-web-services node.js nginx-reverse-proxy

1
推荐指数
1
解决办法
2049
查看次数