-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
70f569d
commit 2439411
Showing
20 changed files
with
779 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
root = true | ||
|
||
[*.cr] | ||
charset = utf-8 | ||
end_of_line = lf | ||
insert_final_newline = true | ||
indent_style = space | ||
indent_size = 2 | ||
trim_trailing_whitespace = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/docs/ | ||
/lib/ | ||
/bin/ | ||
/.shards/ | ||
*.dwarf | ||
|
||
# Libraries don't need dependency lock | ||
# Dependencies will be locked in application that uses them | ||
/shard.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
language: crystal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2018 your-name-here | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in | ||
all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
name: athena | ||
|
||
description: | | ||
Annotation based web framework with built in param conversion. | ||
version: 0.1.0 | ||
|
||
authors: | ||
- Blacksmoke16 <[email protected]> | ||
|
||
crystal: 0.27.0 | ||
|
||
license: MIT | ||
|
||
dependencies: | ||
CrSerializer: | ||
github: blacksmoke16/CrSerializer | ||
radix: | ||
github: luislavena/radix |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
class AthenaController < Athena::ClassController | ||
@[Athena::Get(path: "noParamsGet")] | ||
def self.noParamsGet : String | ||
"foobar" | ||
end | ||
|
||
@[Athena::Get(path: "double/:val1/:val2")] | ||
def self.doubleParams(val1 : Int32, val2 : Int32) : Int32 | ||
it "should run correctly" do | ||
val1.should be_a Int32 | ||
val2.should be_a Int32 | ||
val1.should eq 1000 | ||
val2.should eq 9000 | ||
end | ||
val1 + val2 | ||
end | ||
|
||
@[Athena::Post(path: "noParamsPost")] | ||
def self.noParamsPost : String | ||
"foobar" | ||
end | ||
|
||
@[Athena::Post(path: "double/:val")] | ||
def self.doubleParamsPost(val1 : Int32, val2 : Int32) : Int32 | ||
it "should run correctly" do | ||
val1.should be_a Int32 | ||
val2.should be_a Int32 | ||
val1.should eq 750 | ||
val2.should eq 250 | ||
end | ||
val1 + val2 | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
class BoolController < Athena::ClassController | ||
@[Athena::Get(path: "bool/:val")] | ||
def self.bool(val : Bool) : Bool | ||
it "should run correctly" do | ||
val.should be_a Bool | ||
val.should eq true | ||
end | ||
val | ||
end | ||
|
||
@[Athena::Post(path: "bool")] | ||
def self.boolPost(val : Bool) : Bool | ||
it "should run correctly" do | ||
val.should be_a Bool | ||
val.should eq true | ||
end | ||
val | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
class FloatController < Athena::ClassController | ||
@[Athena::Get(path: "float32/:num")] | ||
def self.float32(num : Float32) : Float32 | ||
it "should run correctly" do | ||
num.should be_a Float32 | ||
num.should eq -2342.223_f32 | ||
end | ||
num | ||
end | ||
|
||
@[Athena::Post(path: "float32/")] | ||
def self.float32Post(num : Float32) : Float32 | ||
it "should run correctly" do | ||
num.should be_a Float32 | ||
num.should eq -2342.223_f32 | ||
end | ||
num | ||
end | ||
|
||
@[Athena::Get(path: "float64/:num")] | ||
def self.float64(num : Float64) : Float64 | ||
it "should run correctly" do | ||
num.should be_a Float64 | ||
num.should eq 2342.234234234223 | ||
end | ||
num | ||
end | ||
|
||
@[Athena::Post(path: "float64")] | ||
def self.float64Post(num : Float64) : Float64 | ||
it "should run correctly" do | ||
num.should be_a Float64 | ||
num.should eq 2342.234234234223 | ||
end | ||
num | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,181 @@ | ||
class IntController < Athena::ClassController | ||
@[Athena::Get(path: "int8/:num")] | ||
def self.int8(num : Int8) : Int8 | ||
it "should run correctly" do | ||
num.should be_a Int8 | ||
num.should eq 123 | ||
end | ||
num | ||
end | ||
|
||
@[Athena::Post(path: "int8")] | ||
def self.int8Post(num : Int8) : Int8 | ||
it "should run correctly" do | ||
num.should be_a Int8 | ||
num.should eq 123 | ||
end | ||
num | ||
end | ||
|
||
@[Athena::Get(path: "int16/:num")] | ||
def self.int16(num : Int16) : Int16 | ||
it "should run correctly" do | ||
num.should be_a Int16 | ||
num.should eq 456 | ||
end | ||
num | ||
end | ||
|
||
@[Athena::Post(path: "int16/")] | ||
def self.int16Post(num : Int16) : Int16 | ||
it "should run correctly" do | ||
num.should be_a Int16 | ||
num.should eq 456 | ||
end | ||
num | ||
end | ||
|
||
@[Athena::Get(path: "int32/:num")] | ||
def self.int32(num : Int32) : Int32 | ||
it "should run correctly" do | ||
num.should be_a Int32 | ||
num.should eq 111111 | ||
end | ||
num | ||
end | ||
|
||
@[Athena::Post(path: "int32")] | ||
def self.int32Post(num : Int32) : Int32 | ||
it "should run correctly" do | ||
num.should be_a Int32 | ||
num.should eq 111111 | ||
end | ||
num | ||
end | ||
|
||
@[Athena::Get(path: "int64/:num")] | ||
def self.int64(num : Int64) : Int64 | ||
it "should run correctly" do | ||
num.should be_a Int64 | ||
num.should eq 9999999999999999 | ||
end | ||
num | ||
end | ||
|
||
@[Athena::Post(path: "int64")] | ||
def self.int64Post(num : Int64) : Int64 | ||
it "should run correctly" do | ||
num.should be_a Int64 | ||
num.should eq 9999999999999999 | ||
end | ||
num | ||
end | ||
|
||
# @[Athena::Get(path: "int128/:num")] | ||
# def self.int128(num : Int128) : Int128 | ||
# it "should run correctly" do | ||
# num.should be_a Int128 | ||
# num.should eq 9999999999999999 | ||
# end | ||
# num | ||
# end | ||
|
||
# @[Athena::Post(path: "int128/:num")] | ||
# def self.int128Post(num : Int128) : Int128 | ||
# it "should run correctly" do | ||
# num.should be_a Int128 | ||
# num.should eq 9999999999999999 | ||
# end | ||
# num | ||
# end | ||
|
||
@[Athena::Get(path: "uint8/:num")] | ||
def self.uint8(num : UInt8) : UInt8 | ||
it "should run correctly" do | ||
num.should be_a UInt8 | ||
num.should eq 123 | ||
end | ||
num | ||
end | ||
|
||
@[Athena::Post(path: "uint8/")] | ||
def self.uint8Post(num : UInt8) : UInt8 | ||
it "should run correctly" do | ||
num.should be_a UInt8 | ||
num.should eq 123 | ||
end | ||
num | ||
end | ||
|
||
@[Athena::Get(path: "uint16/:num")] | ||
def self.uint16(num : UInt16) : UInt16 | ||
it "should run correctly" do | ||
num.should be_a UInt16 | ||
num.should eq 456 | ||
end | ||
num | ||
end | ||
|
||
@[Athena::Post(path: "uint16")] | ||
def self.uint1Post(num : UInt16) : UInt16 | ||
it "should run correctly" do | ||
num.should be_a UInt16 | ||
num.should eq 456 | ||
end | ||
num | ||
end | ||
|
||
@[Athena::Get(path: "uint32/:num")] | ||
def self.uint32(num : UInt32) : UInt32 | ||
it "should run correctly" do | ||
num.should be_a UInt32 | ||
num.should eq 111111 | ||
end | ||
num | ||
end | ||
|
||
@[Athena::Post(path: "uint32")] | ||
def self.uint32Post(num : UInt32) : UInt32 | ||
it "should run correctly" do | ||
num.should be_a UInt32 | ||
num.should eq 111111 | ||
end | ||
num | ||
end | ||
|
||
@[Athena::Get(path: "uint64/:num")] | ||
def self.uint64(num : UInt64) : UInt64 | ||
it "should run correctly" do | ||
num.should be_a UInt64 | ||
num.should eq 9999999999999999 | ||
end | ||
num | ||
end | ||
|
||
@[Athena::Post(path: "uint64/")] | ||
def self.uint64Post(num : UInt64) : UInt64 | ||
it "should run correctly" do | ||
num.should be_a UInt64 | ||
num.should eq 9999999999999999 | ||
end | ||
num | ||
end | ||
|
||
# @[Athena::Get(path: "uint128/:num")] | ||
# def self.uint128(num : UInt128) : UInt128 | ||
# it "should run correctly" do | ||
# num.should be_a UInt128 | ||
# num.should eq 9999999999999999 | ||
# end | ||
# num | ||
# end | ||
|
||
# @[Athena::Post(path: "uint128")] | ||
# def self.uint128Post(num : UInt128) : UInt128 | ||
# it "should run correctly" do | ||
# num.should be_a UInt128 | ||
# num.should eq 9999999999999999 | ||
# end | ||
# num | ||
# end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
class StringController < Athena::ClassController | ||
@[Athena::Get(path: "string/:val")] | ||
def self.string(val : String) : String | ||
it "should run correctly" do | ||
val.should be_a String | ||
val.should eq "sdfsd" | ||
end | ||
val | ||
end | ||
|
||
@[Athena::Post(path: "string")] | ||
def self.stringPost(val : String) : String | ||
it "should run correctly" do | ||
val.should be_a String | ||
val.should eq "sdfsd" | ||
end | ||
val | ||
end | ||
end |
Oops, something went wrong.