From 01ad896154b3133e4820c6c012d6c9ba14cfd5c5 Mon Sep 17 00:00:00 2001 From: Uzlopak Date: Mon, 14 Aug 2023 09:45:22 +0200 Subject: [PATCH] chore: remove express (#227) --- README.md | 19 ---------------- boot.js | 7 ------ package.json | 1 - test/express.test.js | 52 -------------------------------------------- 4 files changed, 79 deletions(-) delete mode 100644 test/express.test.js diff --git a/README.md b/README.md index 41b34cb..80e04e7 100644 --- a/README.md +++ b/README.md @@ -83,7 +83,6 @@ async function third (instance, opts) { * instance.override() * instance.onClose() * instance.close() - * avvio.express() * avvio.toJSON() * avvio.prettyPrint() @@ -444,24 +443,6 @@ also start the boot sequence. Start the boot sequence, if it was not started yet. Returns the `app` instance. -------------------------------------------------------- - - -### avvio.express(app) - -Same as: - -```js -const app = express() -const avvio = require('avvio') - -avvio(app, { - expose: { - use: 'load' - } -}) -``` - ------------------------------------------------------- diff --git a/boot.js b/boot.js index 5c1001c..bc2716f 100644 --- a/boot.js +++ b/boot.js @@ -632,10 +632,3 @@ function encapsulateThreeParam (func, that) { } module.exports = Boot -module.exports.express = function (app) { - return Boot(app, { - expose: { - use: 'load' - } - }) -} diff --git a/package.json b/package.json index afb18d0..29a724a 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,6 @@ "devDependencies": { "@fastify/pre-commit": "^2.0.2", "@types/node": "^20.1.0", - "express": "^4.17.1", "standard": "^17.0.0", "tap": "^16.0.0", "typescript": "^5.0.2" diff --git a/test/express.test.js b/test/express.test.js deleted file mode 100644 index eb223cd..0000000 --- a/test/express.test.js +++ /dev/null @@ -1,52 +0,0 @@ -'use strict' - -const { test } = require('tap') -const express = require('express') -const http = require('http') -const boot = require('..') - -test('express support', (t) => { - const app = express() - - boot.express(app) - // It does: - // - // boot(app, { - // expose: { - // use: 'load' - // } - // }) - - t.plan(2) - - let loaded = false - let server - - app.load(function (app, opts, done) { - loaded = true - app.use(function (req, res) { - res.end('hello world') - }) - - done() - }) - - app.after((cb) => { - t.ok(loaded, 'plugin loaded') - server = app.listen(0, cb) - t.teardown(server.close.bind(server)) - }) - - app.ready(() => { - http.get(`http://localhost:${server.address().port}`).on('response', function (res) { - let data = '' - res.on('data', function (chunk) { - data += chunk - }) - - res.on('end', function () { - t.equal(data, 'hello world') - }) - }) - }) -})