pedronauck / micro-router

:station: A tiny and functional router for Zeit's Micro

Home Page:https://www.npmjs.com/microrouter

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

change listen port

lorenzotsi opened this issue · comments

Hi, more than an issue, it is a question
I was wondering if there is a way to change listen port from the app.js file, instead of using "micro -p 8080", something like

...
let rout = router(get('/hello/:who', hello), get('/*', notfound));
let server = micro(rout);
var port = process.env.PORT || 8080;
server.listen(port, () => console.log('microrouter listening on port ' + port));

Thanks, Lorenzo