skeleton 0.3.0
Skeleton
A very minimal http server api serving as a platform for adding middleware incrementally.
Installation
-
Add the dependency to your
shard.yml
:dependencies: skeleton: github: Oblivious-Oblivious/skeleton
-
Run
shards install
Usage
require "skeleton"
# Initialize a server choose what middleware to add
server = Skeleton::Server.new
.add(Skeleton::CORSHandler.new)
.add(Skeleton::RouteHandler.new # Create a route handler for defining sinatra-like routes
.get "/" { # Define all basic HTTP method routes with callback blocks
"Hello World" # Return a `Renderable` value
}
)
.bind_tcp("127.0.0.1", 8080) # Bind to an address on a port
.listen; # Blocking listen
### Non blocking version
# spawn { server.listen }
###
Development
Future additions / #TODOs
- Write proper documentation
- Refactor the
RouteHandler
to avoid conditionals and multiple execution paths - Try to follow MVC more tightly
Contributing
- Fork it (https://github.com/Oblivious-Oblivious/skeleton/fork)
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request
Contributors
- Oblivious - creator and maintainer
Repository
skeleton
Owner
Statistic
- 1
- 0
- 0
- 2
- 1
- almost 2 years ago
- February 3, 2021
License
GNU General Public License v3.0
Links
Synced at
Sun, 22 Dec 2024 12:39:04 GMT
Languages