Skip to content

Commit

Permalink
fix: remove err param from .listen() callback;
Browse files Browse the repository at this point in the history
- Closes #120, #163
  • Loading branch information
lukeed committed May 22, 2021
1 parent 52d5902 commit 2ce10df
Show file tree
Hide file tree
Showing 17 changed files with 17 additions and 36 deletions.
3 changes: 1 addition & 2 deletions examples/async-json/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ polka()
});
send(res, 200, data);
})
.listen(PORT, err => {
if (err) throw err;
.listen(PORT, () => {
console.log(`> Running on localhost:${PORT}`);
});
3 changes: 1 addition & 2 deletions examples/sub-app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}`);
});
6 changes: 1 addition & 5 deletions examples/with-afterjs/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
});

Expand Down
3 changes: 1 addition & 2 deletions examples/with-apollo/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}`)
});
3 changes: 1 addition & 2 deletions examples/with-body-parser/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}`);
});
3 changes: 1 addition & 2 deletions examples/with-firebase-admin/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}`);
});
3 changes: 1 addition & 2 deletions examples/with-graphql/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ polka()
send(res, 200, data);
});
})
.listen(PORT, err => {
if (err) throw err;
.listen(PORT, () => {
console.log(`> Ready on localhost:${PORT}`);
});
3 changes: 1 addition & 2 deletions examples/with-morgan/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}`);
});
3 changes: 1 addition & 2 deletions examples/with-nextjs/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}`);
});
});
3 changes: 1 addition & 2 deletions examples/with-nuxtjs/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}`);
});
}
3 changes: 1 addition & 2 deletions examples/with-sapper/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}`);
});
3 changes: 1 addition & 2 deletions examples/with-serve-static/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}`);
});
3 changes: 1 addition & 2 deletions examples/with-sirv/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}`);
});
3 changes: 1 addition & 2 deletions examples/with-socketio/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}`);
});

Expand Down
2 changes: 1 addition & 1 deletion examples/with-uws/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}`);
});
3 changes: 1 addition & 2 deletions packages/polka/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`);
});
```
Expand Down
3 changes: 1 addition & 2 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,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`);
});
```
Expand Down

0 comments on commit 2ce10df

Please sign in to comment.