backendium 0.0.0 → 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +3 -2
- package/readme.md +51 -2
package/package.json
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "backendium",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"description": "Express-based javascript backend framework with websocket support",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "Express-based javascript backend framework with websocket support and type-safe checkeasy validators",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
6
7
|
"scripts": {
|
|
7
8
|
"build": "tsc",
|
|
8
9
|
"prepack": "tsc"
|
package/readme.md
CHANGED
|
@@ -3,9 +3,58 @@
|
|
|
3
3
|
# Table of Contents
|
|
4
4
|
> 1. [Installation](#installation)
|
|
5
5
|
> 2. [Basics](#basics)
|
|
6
|
-
> 3. [
|
|
6
|
+
> 3. [Routing](#routing)
|
|
7
7
|
# Installation
|
|
8
|
-
```
|
|
8
|
+
```bash
|
|
9
9
|
npm i backendium checkeasy
|
|
10
10
|
```
|
|
11
11
|
# Basics
|
|
12
|
+
```typescript
|
|
13
|
+
import Backendium from "backendium";
|
|
14
|
+
|
|
15
|
+
const app = new Backendium;
|
|
16
|
+
|
|
17
|
+
app.get("*", (request, response, app, next) => {
|
|
18
|
+
response.end({backendium: "0.0.0"});
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
app.start();
|
|
22
|
+
```
|
|
23
|
+
request:
|
|
24
|
+
```bash
|
|
25
|
+
curl http://localhost:8080/
|
|
26
|
+
```
|
|
27
|
+
response:
|
|
28
|
+
```json
|
|
29
|
+
{"backendium":"0.0.0"}
|
|
30
|
+
```
|
|
31
|
+
# Routing
|
|
32
|
+
## Router class
|
|
33
|
+
```typescript
|
|
34
|
+
// main.ts
|
|
35
|
+
import Backendium from "backendium";
|
|
36
|
+
import handlers from "./handlers.js";
|
|
37
|
+
|
|
38
|
+
const app = new Backendium;
|
|
39
|
+
|
|
40
|
+
app.router(handlers);
|
|
41
|
+
|
|
42
|
+
app.start();
|
|
43
|
+
```
|
|
44
|
+
```typescript
|
|
45
|
+
// handlers.ts
|
|
46
|
+
import {BackendiumRouter} from "backendium/dist/router";
|
|
47
|
+
|
|
48
|
+
const router = new BackendiumRouter;
|
|
49
|
+
|
|
50
|
+
router.get("*", (request, response, app, next) => {
|
|
51
|
+
response.end({backendium: "0.0.0"});
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
export default router;
|
|
55
|
+
```
|
|
56
|
+
Backendium class extends BackendiumRouter
|
|
57
|
+
## GET
|
|
58
|
+
```typescript
|
|
59
|
+
|
|
60
|
+
```
|