https://github.com/felipetesc/expressa-lib
Library to create fast deno web app prototypes
https://github.com/felipetesc/expressa-lib
backend deno prototype server unstable web
Last synced: about 1 month ago
JSON representation
Library to create fast deno web app prototypes
- Host: GitHub
- URL: https://github.com/felipetesc/expressa-lib
- Owner: felipetesc
- License: mit
- Created: 2022-02-27T21:24:37.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2023-04-16T20:11:04.000Z (about 3 years ago)
- Last Synced: 2025-10-20T18:33:52.238Z (8 months ago)
- Topics: backend, deno, prototype, server, unstable, web
- Language: TypeScript
- Homepage:
- Size: 269 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Expressa
To use this micro lib you can import from github, like so:
Installation:
```typescript
import { Handler, AppContext, AppConfigs, Expressa } from "https://raw.githubusercontent.com/felipetesc/expressa-lib/v0.0.5/mod.ts";
```
## Quick start:
First import the lib like we showed above, than create a new handler, such as:
```typescript
class SayGoodbyeHandler extends Handler{
handler(request: Request): Response {
let body = "Goodbye";
return new Response(body, { status: 200 });
}
}
```
The request parameter will give You access to everything needed. You should always return a new response.
Create a new conf class
```typescript
let confs = new AppConfigs();
confs.port = 3000;
```
After that (read the comments below):
```typescript
//create a new AppContext
const appCtx = new AppContext();
//add to the app context a new route to your handler
appCtx.appendRouteHandler("/goodbye", new SayGoodbyeHandler());
//Run your application
Expressa.run(AppConfigs.APP_PORT, appCtx);
```