25 lines
551 B
TypeScript
25 lines
551 B
TypeScript
import { App } from '@kevisual/router'
|
|
|
|
import { sendDefaultSipMessage } from './lib.ts';
|
|
|
|
|
|
const app = new App();
|
|
|
|
// http://localhost:3001/api/router?path=floor
|
|
app.route({
|
|
path: 'floor'
|
|
}).define(async (ctx) => {
|
|
await sendDefaultSipMessage();
|
|
ctx.body = 'SIP消息已发送';
|
|
}).addTo(app)
|
|
|
|
app.route({
|
|
path: 'test'
|
|
}).define(async (ctx) => {
|
|
ctx.body = 'SIP消息已发送';
|
|
}).addTo(app)
|
|
|
|
app.listen(3001, "::", () => {
|
|
console.log('Server is running on http://localhost:3001');
|
|
})
|
|
// curl http://localhost:3001/api/router?path=test
|