ArangoDB:Foxx 微服务入门:404:errorMessage:未知路径 [英] ArangoDB: getting started with Foxx Microservices: 404: errorMessage: unknown path

查看:24
本文介绍了ArangoDB:Foxx 微服务入门:404:errorMessage:未知路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用 ArangoDB 文档 3.3 版3.4 版 用于 Foxx 微服务的入门部分,我无法克服这个错误:

Using ArangoDB documentation version 3.3 or version 3.4 for the Getting Started section of Foxx Microservices, I can't get past this error:

Failed to load API definition.

NetworkError when attempting to fetch resource. http://192.168.1.1:8529/_db/_system/_admin/aardvark/foxxes/docs/swagger.json?mount=/getting-started

该错误显示在服务的 API 选项卡上.根据教程安装我的服务后,我得到了描述的服务卡.我单击该卡片,然后单击 API 选项卡,并显示上述错误.

That error is shown on the API tab of the service. After installing my service according to the tutorial, I get the service's card as described. I click that card and then click the API tab and the above error is shown.

为了消除拼写错误,我尝试从 ArangoDB 文档中复制并粘贴确切的文件内容,并严格按照每个步骤进行操作,但我仍然遇到相同的错误.

To eliminate typos, I have tried copying and pasting the exact file contents from the ArangoDB documentation and following every step exactly, and I still get the same error.

我新创建的 getting-started 服务的信息"选项卡包含以下信息:

The Info tab of my newly created getting-started service contains this info:

作者:
挂载:/getting-started
模式:开发
版本:未知
版本许可:未知许可
路径:/var/lib/arangodb3-apps/_db/_system/getting-started/APP

Author:
Mount: /getting-started
Mode: Development
Version: Unknown
Version License: Unknown License
Path: /var/lib/arangodb3-apps/_db/_system/getting-started/APP

该示例仅包含两个文件,它们是:

The example contains only two files and they are:

manifest.json

manifest.json

{
  "engines": {
    "arangodb": "^3.0.0"
  },
  "main": "index.js"
}

index.js

'use strict';
const createRouter = require('@arangodb/foxx/router');
const router = createRouter();

module.context.use(router);

router.get('/hello-world', function (req, res) {
res.send('Hello World!');
})
.response(['text/plain'], 'A generic greeting.')
.summary('Generic greeting')
.description('Prints a generic greeting.');

预装的演示服务,例如 hello-fox 示例,可以正常工作.我收集了更多错误信息:

The canned demo services, such as the hello-fox example, work correctly. I collected more error information:

导航到 http://192.168.1.1:8529/getting-started

404: errorMessage未知路径'/getting-started'"

404: errorMessage "unknown path '/getting-started'"

导航到http://192.168.1.1:8529/_db/_system/getting-started

404: errorMessage未知路径'/getting-started'"

404: errorMessage "unknown path '/getting-started'"

控制台还显示:

WARNING File not found "/getting-started": file "" does not exist in "/var/lib/arangodb3-apps/_db/_system/getting-started/APP/files".

本教程没有指明另一个名为 getting-started 的文件或两个指定文件的其他位置.我错过了什么?

The tutorial doesn't indicate another file named getting-started or another location for the two specified files. What am I missing?

推荐答案

此问题已根据@camba1 的有用评论得到解决.Arango 没有问题,只是我理解教程有问题.对于我这个职位的其他人,以下是我没有正确理解的事情,但在解决后,我的问题得到了解决.

This issue was resolved based on the helpful comments by @camba1. There was no problem with Arango, just a problem with me understanding the tutorial. For others in my position, here are the things I did not understand properly and that, when addressed, resolved my problems.

  1. API 选项卡,与教程所说的相反,即使对于正常工作的服务,也会给出错误无法加载 API 定义".忽略该错误消息.我还没有使用 API 选项卡.

  1. The API tab, in contrast to what the tutorial says, will give the error "Failed to load API definition" even for a correctly working service. Ignore that error message. I am not yet using the API tab at all.

本教程引用了两条路径,/hello-world"和/getting-started".这些用于端点 (URI) 和创建路由器,如下所示:

the tutorial refers to two paths, '/hello-world' and '/getting-started'. These are used on the endpoint (URI) and in creating the router like below:

router.get('/hello-world', function (req, res) { ...

本教程在这一点上并不像它本来的那样清晰,但正如@camba1 指出的那样,服务端点最终会合并这两个元素:

The tutorial wasn't as clear as it could have been on this point, but as @camba1 pointed out, the service endpoint would end up incorporating both of those elements:

192.168.1.1:8529/_db/_system/getting-started/hello-world .

  1. 在我看来,当路由器在没有路径的情况下创建时,这个非常基本的演示更容易、更好:

  1. this very basic demo is easier and better in my opinion when the router is created without a path:

router.get(function (req, res) {

在这种情况下,它默认为/"路径.我认为这可以避免像我这样的初学者混淆.然后,服务端点变得更简单.就我而言,端点(Arango 在 LAN 上的另一台计算机上运行)变为:

In this case it defaults to a path of '/'. I think this may avoid confusion for raw beginners like me. The service endpoint then becomes one element simpler. In my case, the endpoint (with Arango running on another computer on the LAN) becomes:

192.168.1.1:8529/_db/_system/getting-started

如果本教程添加了几个额外的句子来解释端点的构造方式,或者按照我上面的建议进行并一步步简化,那么本教程将会得到改进.

The tutorial would be improved if it either added a couple extra sentences to explain how the endpoint is constructed, or alternatively, did as I suggested above and simplified things by one step.

这篇关于ArangoDB:Foxx 微服务入门:404:errorMessage:未知路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆