You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Julia noob here! Trying to create a prototype based on your example. Only difference is that I'd like to have a function that adds to an existing array InfoncastSoundFiles.
I get a "function does not accept keyword arguments" error from APIResponder if I'm understanding the error stack correctly. I believe I'm not configuring the create_responder function properly, but it could just be a syntax error elsewhere. Please advise.
Thanks,
Jose
Take a look at my srvr.jl and httpsrvr.jl:
using Dates
using JuliaWebAPI
mutable struct SoundFile
title::String
creator::String
date::String
tags::Array
URL::String
end
#Let's see how this wwould work if this is not a const
#const InfoncastSoundFiles = SoundFile[
const InfoncastSoundFiles = SoundFile[
SoundFile("Fur Elise", "Ludwig Beethoven","12202019",["mp3","song", "music"],"https://URL Here"),
SoundFile("Fidelio", "Ludwig Beethoven","11032011",["song", "dance"],"https://URL Here"),
SoundFile("Missa Solemnis", "Ludwig Beethoven","03102019",["mp3", "song"], "https://URL Here")
]
function listSoundFiles()
return InfoncastSoundFiles
end
function updateSoundFiles(InfoncastSoundFiles, title1, author, date1, tag1, url1)
a = SoundFile(title1,author,date1,tag1,url1);
#push!(InfoncastSoundFiles, a);
append!(InfoncastSoundFiles, a);
#print(InfoncastSoundFiles);
end
process(
JuliaWebAPI.create_responder([
(listSoundFiles, true),
(updateSoundFiles, false)
], "tcp://127.0.0.1:9999", true, "")
)
httpsrvr.jl looks like this:
using JuliaWebAPI #Load package
#Create the ZMQ client that talks to the ZMQ listener above
const apiclnt = APIInvoker("tcp://127.0.0.1:9999");
#Starts the HTTP server in current process
run_http(apiclnt, 8888)
As you can see, there's really not much that's different from the original example. Unfortunately, my lack of experience reading Julia code didn't allow me to decipher the options for JuliaWebAPI.create_responder to be able to configure it properly, which I think is the problem.
I would very much appreciate any help on this. As a matter of fact, I'll make a pull request to add it as one of the examples in the repo if you think it's worthwhile.
Thanks again.
The text was updated successfully, but these errors were encountered:
Don't pay any attention to this. I asked on the Discord forum and got an answer. My function signature had errors In it.
It should look like this:
function updateSoundFiles( ; title1=title1, author1=author1, date1=date1, tag1=tag1, url1=url1)
push!(InfoncastSoundFiles,SoundFile(title1,author1,date1,[tag1],url1))
end
and for some reason testing this via curl results in issues, but with a properly formatted URL it works.
Good to know that you were able to find a solution. I shall close this issue.
The README.md already has an example illustrating the use of keyword arguments. The only difference I see is your usage has only keyword arguments and no positional arguments. Is that what you want to add an example of? Please feel free to send in a PR with more examples!
Hi @tanmaykm and rest of contributors,
Julia noob here! Trying to create a prototype based on your example. Only difference is that I'd like to have a function that adds to an existing array InfoncastSoundFiles.
I get a "function does not accept keyword arguments" error from APIResponder if I'm understanding the error stack correctly. I believe I'm not configuring the create_responder function properly, but it could just be a syntax error elsewhere. Please advise.
Thanks,
Jose
Take a look at my srvr.jl and httpsrvr.jl:
httpsrvr.jl looks like this:
As you can see, there's really not much that's different from the original example. Unfortunately, my lack of experience reading Julia code didn't allow me to decipher the options for JuliaWebAPI.create_responder to be able to configure it properly, which I think is the problem.
I would very much appreciate any help on this. As a matter of fact, I'll make a pull request to add it as one of the examples in the repo if you think it's worthwhile.
Thanks again.
The text was updated successfully, but these errors were encountered: