An open API service indexing awesome lists of open source software.

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

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);

```