https://github.com/molovo/tiny
A Crystal module to help you build multi-threaded HTTP micro-services
https://github.com/molovo/tiny
crystal http microservice
Last synced: 6 months ago
JSON representation
A Crystal module to help you build multi-threaded HTTP micro-services
- Host: GitHub
- URL: https://github.com/molovo/tiny
- Owner: molovo
- License: mit
- Created: 2017-05-21T14:19:00.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-08-16T20:47:17.000Z (over 8 years ago)
- Last Synced: 2025-07-29T21:35:22.058Z (6 months ago)
- Topics: crystal, http, microservice
- Language: Crystal
- Homepage: https://molovo.github.io/tiny
- Size: 1010 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# tiny
A simple wrapper around [HTTP::Server](https://crystal-lang.org/api/0.22.0/HTTP/Server.html) for building CORS-enabled, multi-threaded HTTP micro-services in [Crystal](https://crystal-lang.org).
## Installation
Add this to your application's `shard.yml`:
```yaml
dependencies:
tiny:
github: molovo/tiny
```
## Usage
```crystal
require "tiny"
# Create the handler for incoming requests
serve do |request, response|
# This block will only be run on GET requests
request.get do
response.json({
"message" => "The server is up and running",
"timestamp" => Time.now.to_s,
})
end
# This block will only be run on POST requests
request.post do
# Do something awesome!
end
end
```
## Contributing
1. Fork it ( https://github.com/molovo/tiny/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
- [@molovo](https://github.com/molovo) James Dinsdale - creator, maintainer