mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-07-18 00:47:01 +00:00
26 lines
472 B
JavaScript
26 lines
472 B
JavaScript
'use strict';
|
|
|
|
const http = require('http');
|
|
|
|
const express = require('express');
|
|
const cloudcmd = require('..');
|
|
|
|
module.exports = (fn) => {
|
|
const app = express();
|
|
const server = http.createServer(app);
|
|
const after = () => {
|
|
server.close();
|
|
};
|
|
|
|
app.use(cloudcmd({
|
|
config: {
|
|
auth: false,
|
|
root: __dirname
|
|
}
|
|
}));
|
|
|
|
server.listen(() => {
|
|
fn(server.address().port, after);
|
|
});
|
|
};
|
|
|