Compare commits

...

3 Commits

Author SHA1 Message Date
13b5d6dbdd
Kemal [Crystal] 2023-06-11 18:46:10 +03:00
e4531a92d7
Ctrl+C interrupt [Crystal] 2023-06-11 18:45:45 +03:00
bf0ab3e019
timestamp to date [js] 2023-06-11 18:45:03 +03:00
5 changed files with 44 additions and 0 deletions

View File

@ -0,0 +1,7 @@
require "kemal"
get "/" do
"Hello World!"
end
Kemal.run

19
~/Crystal/Kemal/routes.cr Normal file
View File

@ -0,0 +1,19 @@
get "/" do
..show something..
end
post "/" do
..create something..
end
put "/" do
..replace something..
end
patch "/" do
..modify something..
end
delete "/" do
..a
end

View File

@ -0,0 +1,3 @@
dependencies:
kemal:
github: kemalcr/kemal

View File

@ -0,0 +1,9 @@
LibC.signal Signal::INT.value, ->(s : Int32) {
puts "CTRL-C handler here!"
exit
}
Signal::INT.trap do
puts "CTRL-C handler here!"
exit
end

View File

@ -0,0 +1,6 @@
/*
Необходимо timestamp умножить на 1000, поскольку JavaScript отсчитывает время
с момента epoch (который равен 01/01/1970) в миллисекундах, а не в секундах.
*/
let date = new Date(timestamp * 1000);