UNPKG

1.6 kBJavaScriptView Raw
1"use strict";
2// tslint:disable:no-console
3var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
4 return new (P || (P = Promise))(function (resolve, reject) {
5 function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6 function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7 function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
8 step((generator = generator.apply(thisArg, _arguments || [])).next());
9 });
10};
11Object.defineProperty(exports, "__esModule", { value: true });
12const index_1 = require("../index");
13const manager = new index_1.PluginManager();
14function run() {
15 return __awaiter(this, void 0, void 0, function* () {
16 console.log("Installing express...");
17 yield manager.install("express", "4.16.2");
18 const express = manager.require("express");
19 const app = express();
20 app.get("/", function (req, res) {
21 res.send("Hello World!");
22 });
23 const server = app.listen(3000, function () {
24 console.log("Example app listening on port 3000, closing after 20 secs.!");
25 });
26 setTimeout(() => __awaiter(this, void 0, void 0, function* () {
27 server.close();
28 console.log("Uninstalling plugins...");
29 yield manager.uninstallAll();
30 }), 20000);
31 });
32}
33run()
34 .catch(console.error.bind(console));
35//# sourceMappingURL=express.js.map
\No newline at end of file