Skip to content

A very minimal http server api serving as a platform for adding middleware incrementally.

License

Notifications You must be signed in to change notification settings

Oblivious-Oblivious/skeleton

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

81 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Skeleton

Built with Crystal GitHub release GPLv3 License Docs

CI CI (nightly)

A very minimal http server api serving as a platform for adding middleware incrementally.

Installation

  1. Add the dependency to your shard.yml:

    dependencies:
      skeleton:
        github: Oblivious-Oblivious/skeleton
  2. 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

  1. Fork it (https://github.com/Oblivious-Oblivious/skeleton/fork)
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Contributors

About

A very minimal http server api serving as a platform for adding middleware incrementally.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published