29 lines
404 B
Crystal
29 lines
404 B
Crystal
module Backend
|
|
extend self
|
|
|
|
def run : Nil
|
|
puts "Running backend..."
|
|
puts "-" * 10
|
|
|
|
channel = Channel(Nil).new
|
|
|
|
spawn same_thread: true do
|
|
puts "Starting API..."
|
|
API.run
|
|
|
|
channel.send(nil)
|
|
end
|
|
|
|
spawn same_thread: true do
|
|
puts "Starting worker..."
|
|
Worker.run
|
|
|
|
channel.send(nil)
|
|
end
|
|
|
|
2.times do
|
|
channel.receive
|
|
end
|
|
end
|
|
end
|