Skip to content

Commit 8279dcd

Browse files
committed
feat: expose experimental nanodb endpoint
1 parent 5b883dd commit 8279dcd

File tree

3 files changed

+23
-0
lines changed

3 files changed

+23
-0
lines changed

api/routes/nanodb_experimental.mjs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import express from 'express'
2+
3+
import { request } from '#common'
4+
import { nanodbAPI_experimental } from '#config'
5+
6+
const router = express.Router()
7+
8+
router.get(/^(.*)$/, async (req, res) => {
9+
const { logger } = req.app.locals
10+
try {
11+
const path = req.params[0]
12+
const url = `${nanodbAPI_experimental}${path}`
13+
const data = await request({ url })
14+
res.status(200).send(data)
15+
} catch (error) {
16+
logger(error)
17+
res.status(500).send({ error: 'Nanodb API unavailable' })
18+
}
19+
})
20+
21+
export default router

api/server.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ api.use('/api/*', expressjwt(config.jwt), (err, req, res, next) => {
8484
// unprotected api routes
8585
api.use('/api/node', routes.node)
8686
api.use('/api/nanodb', routes.nanodb)
87+
api.use('/api/nanodb-experimental', routes.nanodb_experimental)
8788
api.use('/api/posts', routes.posts)
8889
api.use('/api/network', routes.network)
8990
api.use('/api/github', routes.github)

config.sample.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ export const storage_mysql = {
4848
}
4949

5050
export const nanodbAPI = ''
51+
export const nanodbAPI_experimental = ''
5152
export const trustedAddresses = []
5253
export const rpcAddresses = []
5354

0 commit comments

Comments
 (0)