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

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

问题描述

使用ArangoDB文档版本3.3

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/入门/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:错误消息:未知路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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