From 3a0c0f2a43bde8d457888f59052e86ea84d3bdd8 Mon Sep 17 00:00:00 2001 From: Andrei Listopadov Date: Tue, 20 Aug 2019 19:01:28 +0300 Subject: [PATCH] fixes server type mismatch #2; --- server/server.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/server/server.ts b/server/server.ts index 1f4537e6..413c7a64 100644 --- a/server/server.ts +++ b/server/server.ts @@ -3,6 +3,7 @@ import { Application } from 'express'; import { getAllCourses, getCourseById } from './get-courses.route'; import { searchLessons } from './search-lessons.route'; import { saveCourse } from './save-course.route'; +import { AddressInfo } from 'net'; const bodyParser = require('body-parser'); @@ -19,7 +20,6 @@ app.route('/api/lessons').get(searchLessons); app.route('/api/courses/:id').put(saveCourse); const httpServer = app.listen(9000, () => { - const addr = httpServer.address(); - const bind = typeof addr === 'string' ? `pipe ${addr}` : `port ${addr.port}`; - console.log(`HTTP REST API Server running at http://localhost: ${bind}`); + const { port } = httpServer.address() as AddressInfo; + console.log(`HTTP REST API Server running at http://localhost: ${port}`); });