bsky-app/scripts/testing-server.mjs

26 lines
709 B
JavaScript
Raw Normal View History

import {IpldStore} from '@adxp/common'
import PDSServer from '@adxp/server/dist/server.js'
import PDSDatabase from '@adxp/server/dist/db/index.js'
import WSRelayServer from '@adxp/ws-relay/dist/index.js'
2022-06-10 18:55:09 +02:00
const PDS_PORT = 2583
const WSR_PORT = 3005
2022-06-10 18:55:09 +02:00
async function start() {
console.log('Initializing...')
const db = PDSDatabase.memory()
2022-06-10 18:55:09 +02:00
const serverBlockstore = IpldStore.createInMemory()
await db.dropTables()
await db.createTables()
PDSServer(serverBlockstore, db, PDS_PORT)
if (process.argv.includes('--relay')) {
WSRelayServer(WSR_PORT)
console.log(`🔁 Relay server running on port ${WSR_PORT}`)
} else {
console.log('Include --relay to start the WS Relay')
}
2022-06-10 18:55:09 +02:00
}
start()