mirror of
https://github.com/storybookjs/storybook.git
synced 2025-03-16 05:03:11 +08:00
15 lines
369 B
TypeScript
15 lines
369 B
TypeScript
import express from 'express';
|
|
import serveStatic from 'serve-static';
|
|
import { Server } from 'http';
|
|
|
|
export const serve = async (location: string, port: string): Promise<Server> => {
|
|
return new Promise((resolve) => {
|
|
const app = express();
|
|
|
|
app.use(serveStatic(location));
|
|
const server = app.listen(port, () => {
|
|
resolve(server);
|
|
});
|
|
});
|
|
};
|