Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/purifetchi/hime
Hime is a stupid-simple web microframework for C#
https://github.com/purifetchi/hime
csharp http microframework network web webdev
Last synced: about 1 month ago
JSON representation
Hime is a stupid-simple web microframework for C#
- Host: GitHub
- URL: https://github.com/purifetchi/hime
- Owner: purifetchi
- License: mit
- Created: 2020-04-08T18:42:56.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-04-10T22:31:28.000Z (over 4 years ago)
- Last Synced: 2023-12-14T14:36:36.937Z (11 months ago)
- Topics: csharp, http, microframework, network, web, webdev
- Language: C#
- Size: 20.5 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Hime
Hime is a stupid-simple web microframework for C#.
It basically aspires to do the same thing as Sinatra did for Ruby. Dead-simple prototyping with little to no effort.Hime isn't near complete at all, it only has a few basic things implemented, but I'll probably forget this project existed in like a day or two, so it doesn't matter nearly as much.
Basically, don't run it in production, or even development. For your own safety.
Or do, I won't judge. Just don't blame me when your PC catches fire or something like this.# How to do anything
1. Clone this repository
2. Link your .NET project against Hime. (Should work fine with both .NET Core and .NET Framework)
3. Create a new class deriving from HimeApplication.
4. Call `HimeRunner.Run` on a new instance of the class.
5. It should work. Hopefully.# How do I create routes?
So far Hime only supports GET and POST (and even then it struggles).
Route declarations are done via attributes, like so:
```cs
[Get("/")]
public ActionResult Index(HimeContext ctx)
{
return Ok("Hello!");
}
```The Ok function automatically returns a 200 response, with the specified body.
If you want a custom response code, you can create your own ActionResult, like this:```cs
[Post("/someroute")]
public ActionResult Route(HimeContext ctx)
{
return new ActionResult
{
Code = 403,
Content = Encoding.UTF8.GetBytes("Go away. You weren't supposed to be here.")
};
}
```# So what's missing?
Quite a lot, actually. You can't get the POST body, PUT/DELETE/PATCH aren't implemented yet, the HimeContext class has almost no information about the context, sessions, file sending, etc.
If you think this project is cool, please send in a pull request and help me out with making this. I'd greatly appreciate any kind of help with this.