spaps 0.2.5 → 0.2.7
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/bin/spaps.js +38 -0
- package/package.json +1 -1
- package/src/docs-html.js +763 -0
- package/src/docs-system.js +806 -0
- package/src/local-server.js +2 -94
package/src/local-server.js
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
const express = require('express');
|
|
9
9
|
const cors = require('cors');
|
|
10
10
|
const chalk = require('chalk');
|
|
11
|
+
const { generateDocsHTML } = require('./docs-html');
|
|
11
12
|
|
|
12
13
|
class LocalServer {
|
|
13
14
|
constructor(options = {}) {
|
|
@@ -167,100 +168,7 @@ class LocalServer {
|
|
|
167
168
|
|
|
168
169
|
// Documentation endpoint
|
|
169
170
|
this.app.get('/docs', (req, res) => {
|
|
170
|
-
res.send(
|
|
171
|
-
<!DOCTYPE html>
|
|
172
|
-
<html>
|
|
173
|
-
<head>
|
|
174
|
-
<title>SPAPS Local Mode</title>
|
|
175
|
-
<style>
|
|
176
|
-
body {
|
|
177
|
-
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
|
178
|
-
max-width: 800px;
|
|
179
|
-
margin: 50px auto;
|
|
180
|
-
padding: 20px;
|
|
181
|
-
line-height: 1.6;
|
|
182
|
-
}
|
|
183
|
-
h1 { color: #ff6b6b; }
|
|
184
|
-
code {
|
|
185
|
-
background: #f4f4f4;
|
|
186
|
-
padding: 2px 6px;
|
|
187
|
-
border-radius: 3px;
|
|
188
|
-
}
|
|
189
|
-
pre {
|
|
190
|
-
background: #f4f4f4;
|
|
191
|
-
padding: 15px;
|
|
192
|
-
border-radius: 5px;
|
|
193
|
-
overflow-x: auto;
|
|
194
|
-
}
|
|
195
|
-
.endpoint {
|
|
196
|
-
margin: 20px 0;
|
|
197
|
-
padding: 15px;
|
|
198
|
-
border-left: 3px solid #ff6b6b;
|
|
199
|
-
background: #fff9f9;
|
|
200
|
-
}
|
|
201
|
-
</style>
|
|
202
|
-
</head>
|
|
203
|
-
<body>
|
|
204
|
-
<h1>🍠 SPAPS Local Development Mode</h1>
|
|
205
|
-
<p>You're running in <strong>local development mode</strong>. No API keys required!</p>
|
|
206
|
-
|
|
207
|
-
<h2>Quick Start</h2>
|
|
208
|
-
<pre>
|
|
209
|
-
// No configuration needed!
|
|
210
|
-
const response = await fetch('http://localhost:${this.port}/api/auth/login', {
|
|
211
|
-
method: 'POST',
|
|
212
|
-
headers: { 'Content-Type': 'application/json' },
|
|
213
|
-
body: JSON.stringify({
|
|
214
|
-
email: 'test@example.com',
|
|
215
|
-
password: 'password'
|
|
216
|
-
})
|
|
217
|
-
});
|
|
218
|
-
const { access_token, user } = await response.json();
|
|
219
|
-
</pre>
|
|
220
|
-
|
|
221
|
-
<h2>Available Endpoints</h2>
|
|
222
|
-
|
|
223
|
-
<div class="endpoint">
|
|
224
|
-
<strong>GET /health</strong> - Health check
|
|
225
|
-
</div>
|
|
226
|
-
|
|
227
|
-
<div class="endpoint">
|
|
228
|
-
<strong>POST /api/auth/login</strong> - Email/password login
|
|
229
|
-
</div>
|
|
230
|
-
|
|
231
|
-
<div class="endpoint">
|
|
232
|
-
<strong>POST /api/auth/register</strong> - Create account
|
|
233
|
-
</div>
|
|
234
|
-
|
|
235
|
-
<div class="endpoint">
|
|
236
|
-
<strong>POST /api/auth/wallet-sign-in</strong> - Wallet authentication
|
|
237
|
-
</div>
|
|
238
|
-
|
|
239
|
-
<div class="endpoint">
|
|
240
|
-
<strong>GET /api/auth/user</strong> - Get current user
|
|
241
|
-
</div>
|
|
242
|
-
|
|
243
|
-
<div class="endpoint">
|
|
244
|
-
<strong>POST /api/stripe/create-checkout-session</strong> - Create payment session
|
|
245
|
-
</div>
|
|
246
|
-
|
|
247
|
-
<div class="endpoint">
|
|
248
|
-
<strong>GET /api/usage/balance</strong> - Check usage balance
|
|
249
|
-
</div>
|
|
250
|
-
|
|
251
|
-
<h2>Test Users</h2>
|
|
252
|
-
<p>Switch between test users by adding <code>?_user=admin</code> or <code>?_user=premium</code> to any request.</p>
|
|
253
|
-
|
|
254
|
-
<h2>Environment</h2>
|
|
255
|
-
<pre>
|
|
256
|
-
Mode: ${process.env.NODE_ENV || 'development'}
|
|
257
|
-
Port: ${this.port}
|
|
258
|
-
Auto-Auth: Enabled
|
|
259
|
-
CORS: Enabled (all origins)
|
|
260
|
-
</pre>
|
|
261
|
-
</body>
|
|
262
|
-
</html>
|
|
263
|
-
`);
|
|
171
|
+
res.send(generateDocsHTML(this.port));
|
|
264
172
|
});
|
|
265
173
|
|
|
266
174
|
// Catch-all for unimplemented routes
|