UNPKG

@onereach/orest-input-cli

Version:

The tool for creating, serving, and publishing OREST Inputs

30 lines (23 loc) 598 B
const path = require('node:path'); const express = require('express'); const cors = require('cors'); const getMeta = require('./getMeta'); const packageLabel = getMeta().label; async function main(options) { const app = express(); app.use(cors()); app.use( express.static(path.join(process.cwd(), 'lib'), { extensions: false, }) ); app.listen(options.port, () => { console.log(`Serve ${packageLabel} at http://localhost:${options.port}`); }); } module.exports = (...args) => { main(...args).catch(err => { console.error(err); process.exit(1); }); };