Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/amaui-org/amaui-api
API
https://github.com/amaui-org/amaui-api
amaui api back-end backend decorators express expressjs js library node nodejs typescript utils web
Last synced: about 2 months ago
JSON representation
API
- Host: GitHub
- URL: https://github.com/amaui-org/amaui-api
- Owner: amaui-org
- License: mit
- Created: 2022-02-03T16:04:03.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2024-03-29T22:26:57.000Z (9 months ago)
- Last Synced: 2024-10-30T02:32:43.322Z (2 months ago)
- Topics: amaui, api, back-end, backend, decorators, express, expressjs, js, library, node, nodejs, typescript, utils, web
- Language: TypeScript
- Homepage: https://docs.amaui.me/library/api
- Size: 248 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
amaui API
API
MIT license
Production ready
100% test cov
Nodejs
Very simple code
Modern code
Junior friendly
Typescript
Made with :yellow_heart:
## Getting started
### Add
```sh
yarn add @amaui/api
```### Use
```javascript
import express from 'express';
import { Route, Method, IRouteClassInstance, Routes } from '@amaui/api';class Base implements IRouteClassInstance {
public response(req: express.Request, response: express.Response, options: { method: 'json' | 'send', type: 'application/json', }) { return ...; }
public error(req: express.Request, error: Error) { return ...; }
}
// Add decorator to a class representing a route
@Route(
'/a',
method
)
class A extends Base {@Method(
'get',
'/a',
method1
)
public a() { }}
// Create an express app
const app = express();// Register all classes as app routes
Routes([A], app);// app routes:
// GET /a/a, middlewares: method, method1// etc.
```### Dev
Install
```sh
yarn
```Test
```sh
yarn test
```### Prod
Build
```sh
yarn build
```