-
Notifications
You must be signed in to change notification settings - Fork 29
Description
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:
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.