diff --git a/examples/async-json/index.js b/examples/async-json/index.js index ce61d18..7313508 100644 --- a/examples/async-json/index.js +++ b/examples/async-json/index.js @@ -17,7 +17,6 @@ polka() }); send(res, 200, data); }) - .listen(PORT, err => { - if (err) throw err; + .listen(PORT, () => { console.log(`> Running on localhost:${PORT}`); }); diff --git a/examples/sub-app/index.js b/examples/sub-app/index.js index 671d541..6123350 100644 --- a/examples/sub-app/index.js +++ b/examples/sub-app/index.js @@ -12,7 +12,6 @@ polka() .get('/', reply) .get('/about', reply) .use('users', users) - .listen(PORT, err => { - if (err) throw err; + .listen(PORT, () => { console.log(`> Running on localhost:${PORT}`); }); diff --git a/examples/with-afterjs/src/index.js b/examples/with-afterjs/src/index.js index dec4833..481c125 100755 --- a/examples/with-afterjs/src/index.js +++ b/examples/with-afterjs/src/index.js @@ -2,11 +2,7 @@ import app from './server'; let { handler, server } = app; -server.listen(process.env.PORT || 3000, error => { - if (error) { - console.log(error); - } - +server.listen(process.env.PORT || 3000, () => { console.log('🚀 started'); }); diff --git a/examples/with-apollo/index.js b/examples/with-apollo/index.js index b61d3e3..897e615 100644 --- a/examples/with-apollo/index.js +++ b/examples/with-apollo/index.js @@ -41,7 +41,6 @@ polka() .get('/graphiql', graphiqlExpress({ endpointURL: '/graphql' })) - .listen(PORT, err => { - if (err) throw err; + .listen(PORT, () => { console.log(`> Ready on localhost:${PORT}`) }); diff --git a/examples/with-body-parser/index.js b/examples/with-body-parser/index.js index e94740b..4544914 100644 --- a/examples/with-body-parser/index.js +++ b/examples/with-body-parser/index.js @@ -9,7 +9,6 @@ polka() let json = JSON.stringify(req.body); res.end(json); }) - .listen(PORT, err => { - if (err) throw err; + .listen(PORT, () => { console.log(`> Running on localhost:${PORT}`); }); diff --git a/examples/with-firebase-admin/index.js b/examples/with-firebase-admin/index.js index 241c4c8..4ce5ede 100644 --- a/examples/with-firebase-admin/index.js +++ b/examples/with-firebase-admin/index.js @@ -9,7 +9,6 @@ const { PORT=3000 } = process.env; polka() .use(cors, compress, json(), serve) .use('api', require('./api')) - .listen(PORT, err => { - if (err) throw err; + .listen(PORT, () => { console.log(`> Running on localhost:${PORT}`); }); diff --git a/examples/with-graphql/index.js b/examples/with-graphql/index.js index dc4b63b..8e6b14e 100644 --- a/examples/with-graphql/index.js +++ b/examples/with-graphql/index.js @@ -39,7 +39,6 @@ polka() send(res, 200, data); }); }) - .listen(PORT, err => { - if (err) throw err; + .listen(PORT, () => { console.log(`> Ready on localhost:${PORT}`); }); diff --git a/examples/with-morgan/index.js b/examples/with-morgan/index.js index e020848..82731ef 100644 --- a/examples/with-morgan/index.js +++ b/examples/with-morgan/index.js @@ -12,7 +12,6 @@ polka() .get('/', (req, res) => { send(res, 'Index'); }) - .listen(PORT, err => { - if (err) throw err; + .listen(PORT, () => { console.log(`> Ready on localhost:${PORT}`); }); diff --git a/examples/with-nextjs/index.js b/examples/with-nextjs/index.js index 056089f..b8117c2 100644 --- a/examples/with-nextjs/index.js +++ b/examples/with-nextjs/index.js @@ -10,8 +10,7 @@ const handle = app.getRequestHandler(); app.prepare().then(() => { polka() .get('*', handle) - .listen(PORT, err => { - if (err) throw err; + .listen(PORT, () => { console.log(`> Ready on http://localhost:${PORT}`); }); }); diff --git a/examples/with-nuxtjs/index.js b/examples/with-nuxtjs/index.js index 0a8d568..ad49969 100644 --- a/examples/with-nuxtjs/index.js +++ b/examples/with-nuxtjs/index.js @@ -23,8 +23,7 @@ if (dev) { } function listen() { - return app.listen(PORT, err => { - if (err) throw err; + return app.listen(PORT, () => { console.log(`> Ready on localhost:${PORT}`); }); } diff --git a/examples/with-sapper/server.js b/examples/with-sapper/server.js index d5afa45..fa2f75d 100644 --- a/examples/with-sapper/server.js +++ b/examples/with-sapper/server.js @@ -14,7 +14,6 @@ global.fetch = (url, opts) => { polka() .use(compression, static, sapper) - .listen(PORT, err => { - if (err) throw err; + .listen(PORT, () => { console.log(`> Running on localhost:${PORT}`); }); diff --git a/examples/with-serve-static/index.js b/examples/with-serve-static/index.js index 846496d..b4284e1 100644 --- a/examples/with-serve-static/index.js +++ b/examples/with-serve-static/index.js @@ -10,7 +10,6 @@ polka() .get('/health', (req, res) => { res.end('OK'); }) - .listen(PORT, err => { - if (err) throw err; + .listen(PORT, () => { console.log(`> Running on localhost:${PORT}`); }); diff --git a/examples/with-sirv/index.js b/examples/with-sirv/index.js index de0d0d1..48cb24b 100644 --- a/examples/with-sirv/index.js +++ b/examples/with-sirv/index.js @@ -8,7 +8,6 @@ polka() .get('/health', (req, res) => { res.end('OK'); }) - .listen(PORT, err => { - if (err) throw err; + .listen(PORT, () => { console.log(`> Running on localhost:${PORT}`); }); diff --git a/examples/with-socketio/index.js b/examples/with-socketio/index.js index 8e68882..fa4918a 100644 --- a/examples/with-socketio/index.js +++ b/examples/with-socketio/index.js @@ -8,8 +8,7 @@ const { PORT=3000 } = process.env; const files = sirv('public'); const server = http.createServer(); -polka({ server }).use(files).listen(PORT, err => { - if (err) throw err; +polka({ server }).use(files).listen(PORT, () => { console.log(`> Running on localhost:${PORT}`); }); diff --git a/examples/with-uws/index.js b/examples/with-uws/index.js index b93f747..bd49770 100644 --- a/examples/with-uws/index.js +++ b/examples/with-uws/index.js @@ -7,6 +7,6 @@ const { handler } = polka().get('/', (req, res) => { res.end('Hello'); }); -http.createServer(handler).listen(PORT, err => { +http.createServer(handler).listen(PORT, () => { console.log(`> Running on localhost:${PORT}`); }); diff --git a/packages/polka/readme.md b/packages/polka/readme.md index 22428dc..debce71 100644 --- a/packages/polka/readme.md +++ b/packages/polka/readme.md @@ -65,8 +65,7 @@ polka() console.log(`~> Hello, ${req.hello}`); res.end(`User: ${req.params.id}`); }) - .listen(3000, err => { - if (err) throw err; + .listen(3000, () => { console.log(`> Running on localhost:3000`); }); ``` diff --git a/readme.md b/readme.md index 8c137fc..2228ca8 100644 --- a/readme.md +++ b/readme.md @@ -65,8 +65,7 @@ polka() console.log(`~> Hello, ${req.hello}`); res.end(`User: ${req.params.id}`); }) - .listen(3000, err => { - if (err) throw err; + .listen(3000, () => { console.log(`> Running on localhost:3000`); }); ```