@riligar/elysia-sqlite 1.3.0 → 1.5.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.
- package/README.md +5 -5
- package/package.json +1 -1
- package/src/index.js +2 -2
package/README.md
CHANGED
|
@@ -40,16 +40,16 @@ const app = new Elysia()
|
|
|
40
40
|
.use(
|
|
41
41
|
sqliteAdmin({
|
|
42
42
|
dbPath: 'demo.db',
|
|
43
|
-
prefix: '/
|
|
43
|
+
prefix: '/sqlite', // Optional: defaults to /sqlite
|
|
44
44
|
})
|
|
45
45
|
)
|
|
46
46
|
.listen(3000)
|
|
47
47
|
|
|
48
48
|
console.log('🦊 Server running at http://localhost:3000')
|
|
49
|
-
console.log('📊 Admin Dashboard at http://localhost:3000/
|
|
49
|
+
console.log('📊 Admin Dashboard at http://localhost:3000/sqlite')
|
|
50
50
|
```
|
|
51
51
|
|
|
52
|
-
On first run, navigate to `/
|
|
52
|
+
On first run, navigate to `/sqlite` (or your configured prefix) to start the onboarding wizard and configure your admin credentials.
|
|
53
53
|
|
|
54
54
|
## ⚙️ Configuration
|
|
55
55
|
|
|
@@ -60,7 +60,7 @@ These options are passed to the `sqliteAdmin` plugin at initialization.
|
|
|
60
60
|
| Option | Type | Default | Description |
|
|
61
61
|
| ------------ | ------ | ----------------------------- | --------------------------------------------------------------- |
|
|
62
62
|
| `dbPath` | string | **Required** | Path to the SQLite database file |
|
|
63
|
-
| `prefix` | string | `"/
|
|
63
|
+
| `prefix` | string | `"/sqlite"` | URL prefix for the admin dashboard and API |
|
|
64
64
|
| `configPath` | string | Same directory as `dbPath` | Path to save the runtime authentication config (JSON). Defaults to `sqlite-admin-config.json` in the same directory as your database file |
|
|
65
65
|
|
|
66
66
|
### Runtime Configuration (via UI)
|
|
@@ -100,7 +100,7 @@ The config file is automatically stored alongside your database, so both will pe
|
|
|
100
100
|
|
|
101
101
|
## 🔌 API Endpoints
|
|
102
102
|
|
|
103
|
-
The plugin adds the following routes under your configured `prefix` (default `/
|
|
103
|
+
The plugin adds the following routes under your configured `prefix` (default `/sqlite`):
|
|
104
104
|
|
|
105
105
|
### Authentication
|
|
106
106
|
|
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -22,11 +22,11 @@ const mimeTypes = {
|
|
|
22
22
|
* Plugin de administração SQLite para ElysiaJS
|
|
23
23
|
* @param {Object} config - Configuração do plugin
|
|
24
24
|
* @param {string} config.dbPath - Caminho para o arquivo do banco SQLite
|
|
25
|
-
* @param {string} config.prefix - Prefixo da rota (ex: '/
|
|
25
|
+
* @param {string} config.prefix - Prefixo da rota (ex: '/sqlite')
|
|
26
26
|
* @param {string} config.configPath - Caminho para o arquivo de configuração de auth.
|
|
27
27
|
* Se não especificado, será salvo no mesmo diretório do banco de dados (recomendado para persistência em ambientes cloud como Fly.io)
|
|
28
28
|
*/
|
|
29
|
-
export const sqliteAdmin = ({ dbPath, prefix = "/
|
|
29
|
+
export const sqliteAdmin = ({ dbPath, prefix = "/sqlite", configPath }) => {
|
|
30
30
|
const db = new Database(dbPath);
|
|
31
31
|
const uiPath = join(import.meta.dir, "ui", "dist");
|
|
32
32
|
|