Uploading Foxx Service - Services: Service undefined installed - from getting started

29 views
Skip to first unread message

Jarok Galdifai

unread,
Aug 10, 2020, 7:06:19 AM8/10/20
to ArangoDB
Hello,

i followed the instructions on from "getting started".

When i upload and install the service i get the message "Services: service undefined installed" and the the API section of the service i can only see a swagger button which show me this:

{
 
"swagger": "2.0",
 
"basePath": "/_db/telefonie/getting-started",
 
"paths": {
 
"/hello-world": {
 
"get": {
 
"produces": [
 
"text/plain",
 
"application/json"
 
],
 
"parameters": [],
 
"description": "Prints a generic greeting.",
 
"summary": "Generic greeting",
 
"tags": [],
 
"consumes": [],
 
"responses": {
 
"200": {
 
"schema": {
 
"type": "string"
 
},
 
"description": "A generic greeting."
 
},
 
"500": {
 
"description": "Default error response.",
 
"schema": {
 
"type": "object",
 
"properties": {
 
"error": {
 
"anyOf": [
 
{
 
"type": "any",
 
"enum": [
 
true
 
]
 
},
 
{
 
"type": [
 
"array",
 
"boolean",
 
"number",
 
"object",
 
"string",
 
"null"
 
]
 
}
 
]
 
},
 
"errorNum": {
 
"type": "integer"
 
},
 
"errorMessage": {
 
"type": "string"
 
},
 
"code": {
 
"type": "integer"
 
}
 
},
 
"additionalProperties": false,
 
"patterns": [],
 
"required": [
 
"error"
 
]
 
}
 
}
 
}
 
}
 
}
 
},
 
"info": {
 
"description": "",
 
"license": {}
 
}
}



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.');

Would be nice if someone could give me a hint where the issue is.


noel del rosario

unread,
Aug 18, 2020, 7:45:45 AM8/18/20
to ArangoDB

I had the same problem before , and I found out an easier way to accomplish this.
create an empty DIRECTORY and name it hello (In window , mkdir hello)
Get into this DIrectory (cd hello)
execute this command ,  foxx init -e
This will create the initial files you can start with ( manifest.json, index.js)
Next, you ZIP the directory file hello ( you have to go out 1 level higher to your hello Directory, you can do  cd ..)
you can now xompressed ZIP file your Deirectory hello to hello.zip.

Go to your ARANGODB  web interface by browsing http://127.0.0.1:8529/_db/_system/_admin/aardvark/index.html#login
LOGIN as root or any user that can access ARANGODB.

GO TO SERVICES > Add Service > Upload > Drag&Drop your hello.Zip file > Install > 

Enter a Mount point: /hello > Install 

VIOLA you got your /hello Foxx API Services > CLICK on it > API

You can now revise your manifest.json and index.js files to run an API.

Refer to this site to create some simple foxx APIs

CHEERS .... ENJOY....
Reply all
Reply to author
Forward
0 new messages