@patchworkdev/pdk
Version:
Patchwork Development Kit
34 lines (33 loc) • 1.25 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.launchWizardApp = void 0;
const node_server_1 = require("@hono/node-server");
const serve_static_1 = require("@hono/node-server/serve-static");
const hono_1 = require("hono");
const path_1 = __importDefault(require("path"));
const logger_1 = require("./common/helpers/logger");
const launchWizardApp = () => {
const app = new hono_1.Hono();
// logger.info(process.cwd());
// logger.info(__dirname);
const rel = path_1.default.relative(process.cwd(), __dirname);
// logger.info(rel);
app.get('/api', async (c) => {
return c.text('Hello from Patchwork Wizard API');
});
app.use('/*', (0, serve_static_1.serveStatic)({
root: `${rel}/wizard`,
onNotFound: (path, c) => {
// logger.info(`${path} is not found, checked ${c.req.path}`)
},
}));
(0, node_server_1.serve)({
fetch: app.fetch,
port: 3333,
});
logger_1.logger.info('Patchwork Wizard is running on http://localhost:3333');
};
exports.launchWizardApp = launchWizardApp;