Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/icyleaf/salt
**Unmaintained** A Human Friendly Interface for HTTP server written in Crystal.
https://github.com/icyleaf/salt
crystal webserver webserver-interface
Last synced: 3 months ago
JSON representation
**Unmaintained** A Human Friendly Interface for HTTP server written in Crystal.
- Host: GitHub
- URL: https://github.com/icyleaf/salt
- Owner: icyleaf
- License: mit
- Archived: true
- Created: 2017-11-23T03:21:34.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2018-11-19T06:10:29.000Z (almost 6 years ago)
- Last Synced: 2024-06-22T02:49:29.973Z (5 months ago)
- Topics: crystal, webserver, webserver-interface
- Language: Crystal
- Homepage:
- Size: 97.7 KB
- Stars: 19
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-crystal - salt - A Human Friendly Interface for HTTP server (Web Servers)
README
A Human Friendly Interface for HTTP webservers written in Crystal.
"Salt" icon by Creative Stall from Noun Project.## Installation
Add this to your application's `shard.yml`:
```yaml
dependencies:
salt:
github: icyleaf/salt
branch: master
```## Usage
```crystal
require "salt"
require "salt/middlewares/session/cookie"
require "salt/middlewares/logger"class Talk < Salt::App
def call(env)
env.session.set("username", "icyleaf")
env.logger.info("Start Talking!")
{400, { "Content-Type" => "text/plain" }, ["Can I talk to salt?"]}
end
endclass Shout < Salt::App
def call(env)
call_app(env)env.logger.debug("Shout class")
{status_code, headers, body.map &.upcase }
end
endclass Speaking < Salt::App
def call(env)
call_app(env)env.logger.debug("Speaking class")
{200, headers, ["This is Slat speaking! #{env.session.get("username")}"]}
end
endSalt.use Salt::Session::Cookie, secret: ""
Salt.use Salt::Logger, level: Logger::DEBUG, progname: "app"
Salt.use Shout
Salt.use SpeakingSalt.run Talk.new
```## Available middleware
- [x] `ShowExceptions`
- [x] `CommonLogger`
- [x] `Logger`
- [x] `Runtime`
- [x] `Session` (Cookie/Redis)
- [x] `Head`
- [x] `File`
- [x] `Directory`
- [x] `Static`
- [ ] `SendFile`
- [x] `ETag`
- [x] `BasicAuth`
- [x] `Router` (lightweight)All these components use the same interface, which is described in detail in the Salt::App specification. These optional components can be used in any way you wish.
## How to Contribute
Your contributions are always welcome! Please submit a pull request or create an issue to add a new question, bug or feature to the list.
All [Contributors](https://github.com/icyleaf/salt/graphs/contributors) are on the wall.
## You may also like
- [halite](https://github.com/icyleaf/halite) - HTTP Requests Client with a chainable REST API, built-in sessions and loggers.
- [totem](https://github.com/icyleaf/totem) - Load and parse a configuration file or string in JSON, YAML, dotenv formats.
- [markd](https://github.com/icyleaf/markd) - Yet another markdown parser built for speed, Compliant to CommonMark specification.
- [poncho](https://github.com/icyleaf/poncho) - A .env parser/loader improved for performance.
- [popcorn](https://github.com/icyleaf/popcorn) - Easy and Safe casting from one type to another.
- [fast-crystal](https://github.com/icyleaf/fast-crystal) - 💨 Writing Fast Crystal 😍 -- Collect Common Crystal idioms.## Resouces
Heavily inspired from Ruby's rack gem.
## License
[MIT License](https://github.com/icyleaf/salt/blob/master/LICENSE) © icyleaf