#!/usr/bin/env node
'use strict';
const http = require('http');
const Agenda = require('agenda');
const agendash = require('../app');
const express = require('express');
const program = require('commander');

program
  .option('-d, --db <db>', '[required] Mongo connection string, same as Agenda connection string')
  .option('-c, --collection <collection>', '[optional] Mongo collection, same as Agenda collection name, default agendaJobs', 'agendaJobs')
  .option('-p, --port <port>', '[optional] Server port, default 3000', (n, d) => Number(n) || d, 3000)
  .option('-t, --title <title>', '[optional] Page title, default Agendash', 'Agendash')
  .parse(process.argv);

if (!program.db) {
  console.error('--db required');
  process.exit(1);
}

const app = express();

const agenda = new Agenda().database(program.db, program.collection);
app.use('/', agendash(agenda, {
  title: program.title
}));

app.set('port', program.port);

const server = http.createServer(app);
server.listen(program.port, () => {
  console.log(`Agendash started http://localhost:${program.port}`);
});

@@ -640,16 +640,102 @@
 ndash')%0A
+  .option('-p, --path %3Cpath%3E', '%5Boptional%5D Path to bind Agendash to, default /', '/')%0A
   .parse
@@ -750,16 +750,16 @@
 .argv);%0A
-
 %0Aif (!pr
@@ -928,19 +928,28 @@
 app.use(
-'/'
+program.path
 , agenda
@@ -1097,16 +1097,16 @@
 () =%3E %7B%0A
-
   consol
@@ -1161,16 +1161,31 @@
 am.port%7D
+$%7Bprogram.path%7D
 %60);%0A%7D);%0A

Add --path to Agendash CLI. Via #125