File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change 11#!/usr/bin/env node
22
3+ import process from 'node:process' ;
34import puppeteer from 'puppeteer' ;
4- import path from 'path' ;
5- import fs from 'fs' ;
5+ import path from 'node: path' ;
6+ import fs from 'node: fs' ;
67import express from 'express' ;
7- import url from 'url' ;
8+ import url from 'node: url' ;
89const app = express ( ) ;
910const port = 3000 ;
1011const __dirname = path . dirname ( url . fileURLToPath ( import . meta. url ) ) ; // eslint-disable-line
1112
1213app . use ( express . static ( path . dirname ( __dirname ) ) ) ;
13- const server = app . listen ( port , ( ) => {
14+ const server = app . listen ( port , ( err ) => {
15+ if ( err ) {
16+ console . error ( 'Error starting server:' , err ) ;
17+ // eslint-disable-next-line no-process-exit
18+ process . exit ( 1 ) ;
19+ }
1420 console . log ( `Example app listening on port ${ port } !` ) ;
1521 test ( port ) ;
1622} ) ;
You can’t perform that action at this time.
0 commit comments