微信开发中 ACCESS TOKEN 过期失效的解决方案详解
632
2022-11-01
Drash 一个用于Deno的HTTP服务器的REST微框架,零依赖
Drash
A REST microframework for Deno's HTTP server with zero dependencies.
Table of Contents
Quick StartCreate Drash AppDocumentationFeaturesWhy use Drash?ArticlesBenchmarksContributingLicense
Quick Start
// File: app.tsimport { Drash } from "https://deno.land/x/drash@v1.x/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({ response_output: "text/html", resources: [HomeResource]});server.run({ hostname: "localhost", port: 1447});console.log("Server listening: http://localhost:1447");
$ deno run --allow-net app.tsServer listening: http://localhost:1447
$ curl localhost:1447Hello World! deno + Drash is cool!
Create Drash App
Drash provides a basic tool to help you quickly create a Drash skeleton, with everything working out of the box, ready for you to build something great with.
This tool does not require you to install any Drash scripts or modules. It will create the skeleton of your choice (an API, a full web app, or a full web app with Vue) inside your current working directory.
To get started with the Create Drash App tool, see the following commands:
$ mkdir my-drash-project$ cd my-drash-project
To make an API: $ deno run --allow-run --allow-read --allow-write --allow-net https://deno.land/x/drash/create_app.ts --api To make a web app: $ deno run --allow-run --allow-read --allow-write --allow-net https://deno.land/x/drash/create_app.ts --web-app To make a web app with Vue: $ deno run --allow-run --allow-read --allow-write --allow-net https://deno.land/x/drash/create_app.ts --web-app --with-vue
Display the options with --help:
$ deno run --allow-run --allow-read https://deno.land/x/drash/create_app.ts --help
Documentation
Full Documentation
Lifecycle Diagram
Drash Approved Middleware
Features
Content NegotiationStatic Path RoutingRegex Path RoutingMiddlewareDrash Approved MiddlewareBody Handling: application/jsonBody Handling: application/x-www-form-urlencodedBody Handling: multipart/form-dataHandling Path ParamsHandling URL Query ParamsConsole LoggingFile Logging
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 extensibleLaravel — use of similarly styled middlewareTonic — use of resourcesRESTful principles — content negotiation, HTTP verbs, URIs, etc.
Thrown into the mix is Drash's own concepts such as:
Documentation-driven developmentTest-driven developmentLowering 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.
Articles
Why Was Drash built?What Makes Drash Different?
Benchmarks
Check out our benchmarks here.
Contributing
Contributors are welcomed!
Please read through our contributing guidelines. Included are directions for opening issues, coding standards, and notes on development.
License
By contributing your code, you agree to license your contribution under the MIT License.
版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。
发表评论
暂时没有评论,来抢沙发吧~