Drash
A REST microframework for Deno.
// File: app.ts
import Drash from "https://deno.land/x/drash/mod.ts";
// or import Drash from "https://deno.land/x/drash@{version}/mod.ts";
class HomeResource extends Drash.Http.Resource {
static paths = ["/"];
public GET() {
this.response.body = "Hello World! deno + Drash is cool!";
return this.response;
}
}
const server = new Drash.Http.Server({
address: "localhost:1337",
response_output: "text/html",
resources: [HomeResource]
});
server.run();
$ deno --allow-net app.ts
$ curl localhost:1337
Hello World! deno + Drash is cool!
Documentation
Full documentation: https://drash.land
Repository: deno-drash-docs
Features
- Content Negotiation
- Static Path Routing
- Regex Path Routing
- Middleware
- Body Handling: application/json
- Body Handling: application/x-www-form-urlencoded
- Body Handling: multipart/form-data
- Handling Path Params
- Handling URL Query Params
Why Use Drash?
Drash is designed to help you build your projects quickly with the ability to scale. You can build an API, a web app, an SPA (like the documentation pages), or even a static HTML site. How you use Drash is up to you, so it can be everything you need and nothing you don't — like a DRASH tent.
Drash takes concepts from the following:
- Flask — being micro and extensible
- Laravel — use of similarly styled middleware
- Tonic — use of resources
- RESTful principles — content negotiation, HTTP verbs, URIs, etc.
Thrown into the mix is Drash's own concepts such as:
- Documentation-driven development
- Test-driven development
- Lowering barriers to usage
Drash does not force you to use all of its code. You can pick and choose which data members you want/need and use them however you deem fit. For example, Drash comes with a console logger and a file logger. If you only want these, then you only import these into your non-Drash project. How you use it is really up to you.
Contributing
Contributors are welcomed!