stackpress
Version:
Incept is a content management framework.
14 lines (13 loc) • 489 B
JavaScript
import { action } from '@stackpress/ingest/Server';
import emit from '../../scripts/emit.js';
export default action(async function EmitScript(_req, res, ctx) {
const cli = ctx.plugin('cli');
if (process.argv.length < 4) {
cli?.verbose && cli.control.error('Missing event name');
res.setError('Missing event name');
return;
}
cli?.verbose && cli.control.system(`Emitting "${process.argv[3]}"...`);
await emit(ctx, 3);
res.setStatus(200);
});