1 |
|
2 |
|
3 | import {PluginManager} from "../index";
|
4 |
|
5 | const manager = new PluginManager();
|
6 |
|
7 | async function run() {
|
8 | console.log("Installing express...");
|
9 | await manager.install("express", "4.16.2");
|
10 |
|
11 | const express = manager.require("express");
|
12 |
|
13 | const app = express();
|
14 |
|
15 | app.get("/", function(req: any, res: any) {
|
16 | res.send("Hello World!");
|
17 | });
|
18 |
|
19 | const server = app.listen(3000, function() {
|
20 | console.log("Example app listening on port 3000, closing after 20 secs.!");
|
21 | });
|
22 |
|
23 | setTimeout(async () => {
|
24 | server.close();
|
25 | console.log("Uninstalling plugins...");
|
26 | await manager.uninstallAll();
|
27 | }, 20000);
|
28 | }
|
29 |
|
30 | run()
|
31 | .catch(console.error.bind(console));
|