HI Team,
I am trying to create a calculator app in julia with Genie web framwork for API , but I am getting below error
using Genie, Genie.Router, Genie.Renderer.Json
# Load the separate modules
include("src/addition.jl")
include("src/subtraction.jl")
using .Addition
using .Subtraction
# Define API routes
route("/add/:a/:b", method="POST") do
a = parse(Int, params(:a))
b = parse(Int, params(:b))
result = add(a, b)
Json(json(:result => result))
end
route("/subtract/:a/:b", method="GET") do
a = parse(Int, params(:a))
b = parse(Int, params(:b))
result = subtract(a, b)
Json(json(:result => result))
end
# Start the Genie server
Genie.config.run_as_server = true
Genie.Server.up()
#GenieAppServer.startup()
#Genie.config.run_as_server = true # Make sure the app runs as a server
#Genie.startup() # This starts the Genie application
Addition file
module Addition
export add
function add(a::Int, b::Int)
return a + b
end
end # module
error below
500 Internal Error - UndefVarError: `add` not defined