@acastellon/ws-dns
v1.1.0
Published
WS DNS system (Ad-hoc Discovery WS system)
Readme
@acastellon/ws-dns
WS DNS system ( Ad-hoc Discovery WS system) - server side for service registration/discovery.
This module was incomplete/minimal in the original repo. It is the server counterpart to the @acastellon/dns-client module.
Intended API / Endpoints (implement these)
Typical REST/WS endpoints a full implementation should expose (versioned):
GET /:version/ping→ 200/201 if healthyGET /:version/get/:service_id→ returns { service: { PROTOCOL, IP_OR_CNAME, PORT, METHOD } } or errorPOST /:version/set/:service_idwith body { PROTOCOL, PORT, METHOD } → registers the service address
Example server skeleton (what you would implement):
const express = require('express');
const app = express();
app.use(express.json());
const services = {}; // or use a real store
app.get('/:version/ping', (req, res) => res.sendStatus(200));
app.get('/:version/get/:service_id', (req, res) => {
const svc = services[req.params.service_id];
if (svc) res.json({ service: svc });
else res.status(404).json({ error: 'not found' });
});
app.post('/:version/set/:service_id', (req, res) => {
services[req.params.service_id] = req.body;
res.sendStatus(201);
});
app.listen(7777, () => console.log('WS DNS server stub running'));Install
npm install @acastellon/ws-dnsCurrent stub
The index.js exports a factory that returns a minimal object with start, register, get. Replace with real Express + storage.
License
MIT
