princejs 1.0.0 → 1.1.0

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.
Files changed (2) hide show
  1. package/Readme.md +83 -0
  2. package/package.json +1 -1
package/Readme.md ADDED
@@ -0,0 +1,83 @@
1
+ # PrinceJS
2
+
3
+ **The fastest backend framework ever made by a 13-year-old Nigerian.** <br>
4
+ **Under 2 kB • Beats Hono • Built in 3 days** <br>
5
+
6
+ ---
7
+
8
+ ### Install
9
+
10
+ ```bash
11
+ pnpm add princejs
12
+ # or
13
+ bun add princejs
14
+ # or
15
+ npm install princejs
16
+ ```
17
+
18
+ ### Quick Start
19
+
20
+ ```bash
21
+ import { Prince } from 'princejs';
22
+
23
+ const app = new Prince();
24
+
25
+ // CORS + logging
26
+ app.use(async (req, next) => {
27
+ console.log(`${req.method} ${req.url}`);
28
+ const res = await next();
29
+ res.headers.set('Access-Control-Allow-Origin', '*');
30
+ return res;
31
+ });
32
+
33
+ // Global error handler
34
+ app.error((err) => app.json({ error: err.message }, 500));
35
+
36
+ // Routes
37
+ app.get('/', () => app.json({ hello: 'PrinceJS', age: 13 }));
38
+
39
+ app.post('/pay', async (req) => {
40
+ let body = {};
41
+ try { body = await req.json(); } catch {}
42
+ return app.json({ url: `https://stripe.com/pay/${body.amount || 999}` });
43
+ });
44
+
45
+ app.listen(3000);
46
+ ```
47
+
48
+ ### Features
49
+
50
+ All HTTP methods (GET POST PUT DELETE PATCH OPTIONS HEAD)
51
+
52
+ ```bash
53
+ app.json(data, status?) — clean JSON with status
54
+ app.error(handler) — global error handling
55
+ ```
56
+
57
+
58
+ ### Benchmarks (real Windows laptop)
59
+ ```bash
60
+ PrinceJS: 24k–44k requests in 10s
61
+ Hono: 20k–40k requests in 10s
62
+ Express: ~7k requests in 10s
63
+ ```
64
+
65
+ Same code. Same features. Same machine.
66
+
67
+ ### Author
68
+ Matthew Micheal — Age 13 — Nigeria
69
+
70
+ Made in PowerShell on a school laptop.
71
+
72
+ ### Links
73
+
74
+ npm: https://www.npmjs.com/package/princejs
75
+
76
+ GitHub: https://github.com/MatthewTheCoder1218/princejs
77
+
78
+
79
+ PrinceJS — Small. Fast. Unbeatable.
80
+
81
+ ```bash
82
+ pnpm add princejs
83
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "princejs",
3
- "version": "1.0.0",
3
+ "version": "1.1.0",
4
4
  "description": "An easy and fast backend framework — by a 13yo developer, for developers.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",