Skip to content

Commit

Permalink
wip readme
Browse files Browse the repository at this point in the history
  • Loading branch information
AntoineLep committed Sep 28, 2023
1 parent 0af4b76 commit 3bb46dd
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 2 deletions.
60 changes: 58 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,69 @@
# anthill-framework
# Anthill Framework

A fast, reliable dependence less framework for building serverless backend applications
A lightweight, fast and reliable dependence less TypeScript framework for building powerfull serverless backend applications.

[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://github.com/AntL4b/anthill-framework/blob/main/LICENSE)
[![Build][build-image]][build-url]
[![Coverage Status][coveralls-image]][coveralls-url]
[![NPM Version][npm-version-image]][npm-url]
[![NPM Install Size][npm-install-size-image]][npm-install-size-url]

The project aims to provide an environment and tools for developing REST API using AWS Lambdas and API Gateway. It comes with an HTTP request handling system that can handle caching requests, run middlewares, deal with CORS and much more ! It can handle classic AWS Lambda invocation as well (i.e. No HTTP / AWS API Gateway integration)

Anthill comes with strong typing and structure because code benefits from being explicit and readability counts.

## Quick start

Here is how we can code a simple "Hello world" example:

```ts
import {
AHAwsEvent,
AHHttpResponse,
AHHttpResponseBodyStatusEnum,
AHRestMethodEnum,
RestController,
RestHandler,
anthill,
} from "@antl4b/anthill-framework";

@RestController()
class MyController {
/**
* Handle the request
* @param event AWS event
* @returns My handler response
*/
@RestHandler({ method: AHRestMethodEnum.Get })
myHandler(event: AHAwsEvent): AHHttpResponse {
return AHHttpResponse.success({
status: AHHttpResponseBodyStatusEnum.Success,
payload: "Hello World",
});
}
}

const app = anthill();

app.configure({
controllers: [MyController],
});

const handlers = app.exposeHandlers();
exports.myHandler = handlers.myHandler;
```

```bash
$ curl --request GET 'http://localhost:3000/dev/my-handler'
{"status":"success","payload":"Hello world"}
```

## Installation
This is a [Node.js](https://nodejs.org/en/) module available through the npm registry. Installation is done using the npm install command:
```bash
$ npm install @antl4b/anthill-framework --save
```

[build-image]: https://github.com/AntL4b/anthill-framework/actions/workflows/build.yml/badge.svg
[build-url]: https://github.com/AntL4b/anthill-framework/actions/workflows/build.yml
[coveralls-image]: https://coveralls.io/repos/github/AntL4b/anthill-framework/badge.svg
Expand Down
6 changes: 6 additions & 0 deletions todo.todo
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
- path param
- body param (prio parsed from middleware json body)
- ...
- Testing
- DTO
- spec in (will replace middleware for qs and body check)
- spec out
Expand All @@ -14,7 +15,12 @@

- Documentation
- Quick start
- Installation
- Configuration
- Decorators
- Basic REST todo example (remove Cors from serverless)
- Project structure
- Routing (no routing)
- Accessing path params
- Accessing body params
- Accessing querystring params
Expand Down

0 comments on commit 3bb46dd

Please sign in to comment.