mirror of
https://github.com/logto-io/logto.git
synced 2025-04-07 23:01:25 -05:00
refactor(core): update app running info (#765)
* refactor(core): update app running info * refactor(core): per review
This commit is contained in:
parent
9f3b7e4cd6
commit
6a5e5799d0
2 changed files with 8 additions and 3 deletions
|
@ -1,6 +1,7 @@
|
|||
import fs from 'fs/promises';
|
||||
import https from 'https';
|
||||
|
||||
import chalk from 'chalk';
|
||||
import Koa from 'koa';
|
||||
import koaLogger from 'koa-logger';
|
||||
import mount from 'koa-mount';
|
||||
|
@ -16,6 +17,10 @@ import koaSpaProxy from '@/middleware/koa-spa-proxy';
|
|||
import initOidc from '@/oidc/init';
|
||||
import initRouter from '@/routes/init';
|
||||
|
||||
const logListening = (port: number, protocol: 'https' | 'http') => {
|
||||
console.log(chalk.bold(chalk.green(`App is running at ${protocol}://localhost:${port}`)));
|
||||
};
|
||||
|
||||
export default async function initApp(app: Koa): Promise<void> {
|
||||
app.use(koaErrorHandler());
|
||||
app.use(koaOIDCErrorHandler());
|
||||
|
@ -43,13 +48,13 @@ export default async function initApp(app: Koa): Promise<void> {
|
|||
app.callback()
|
||||
)
|
||||
.listen(port, () => {
|
||||
console.log(`App is listening on port ${port} with HTTPS`);
|
||||
logListening(port, 'https');
|
||||
});
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
app.listen(port, () => {
|
||||
console.log(`App is listening on port ${port}`);
|
||||
logListening(port, 'http');
|
||||
});
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@ node -e "$(printf "%s" "$(curl -fsSL https://raw.githubusercontent.com/logto-io/
|
|||
The script will download Logto and create a directory `logto` in the location you ran it. After answering [several simple questions](./tutorial/configuration#questions), you will see the message like:
|
||||
|
||||
```bash
|
||||
Server is listening to port 3001
|
||||
App is running at http://localhost:3001
|
||||
```
|
||||
|
||||
Heading to http://localhost:3001 to continue the Logto journey. Enjoy!
|
||||
|
|
Loading…
Add table
Reference in a new issue