express-pretty-listen
v1.0.1
Published
Simple express server runner that will print out automatically port and current package name in the terminal once the server is started.
Downloads
1
Readme
express-pretty-listen
A simple Express server runner that automatically prints the port and current package name to the terminal once the server starts.
List of parameters
port
- Port number where the app will runhost
(optional) - Option to overwrite the default valuehttp://localhost
server
- Your Express server
Getting started
Install
npm install express-pretty-listen
Use to start server
Do not use listen()
method from express. Use serveExpressServer
instead.
import cors from "cors";
import express from "express";
import { serveExpressServer } from "express-pretty-listen";
export const server = express() //
.use(cors())
.use(express.json());
serveExpressServer({ server, port: 4000 });
Output
Once you start a server script will automatically detect package name and will output table with package name and link with port to the app.
Example output when server starts:
┌─────────┬────────────────────────────┐
│ Package │ @steadysass/server-express │
├─────────┼────────────────────────────┤
│ Server │ http://localhost:4000 │
└─────────┴────────────────────────────┘