@@ -2,23 +2,29 @@ import path from "path";
22import { fileURLToPath } from "url" ;
33import { rimraf } from "rimraf" ;
44import copyDir from "copy-dir" ;
5+ import { WEB_PORT } from "./server/credentials.js" ;
56import { createWebDAVServer } from "./server/index.js" ;
67
7- const dirname = path . dirname ( fileURLToPath ( import . meta. url ) ) ;
8+ ( async ( ) => {
9+ const dirname = path . dirname ( fileURLToPath ( import . meta. url ) ) ;
810
9- rimraf . sync ( path . resolve ( dirname , "./testContents" ) ) ;
10- copyDir . sync ( path . resolve ( dirname , "./serverContents" ) , path . resolve ( dirname , "./testContents" ) ) ;
11+ rimraf . sync ( path . resolve ( dirname , "./testContents" ) ) ;
12+ copyDir . sync (
13+ path . resolve ( dirname , "./serverContents" ) ,
14+ path . resolve ( dirname , "./testContents" )
15+ ) ;
1116
12- const server = createWebDAVServer ( 45000 , "basic" ) ;
13- server . start ( ) . then ( ( ) => {
14- console . log ( "Server started" ) ;
15- } ) ;
17+ const server = createWebDAVServer ( WEB_PORT , "basic" ) ;
18+ server . start ( ) . then ( ( ) => {
19+ console . log ( "Server started" ) ;
20+ } ) ;
1621
17- process . on ( "SIGTERM" , function ( ) {
18- server . stop ( ) ;
19- process . exit ( 0 ) ;
20- } ) ;
21- process . on ( "SIGINT" , function ( ) {
22- server . stop ( ) ;
23- process . exit ( 0 ) ;
24- } ) ;
22+ process . on ( "SIGTERM" , function ( ) {
23+ server . stop ( ) ;
24+ process . exit ( 0 ) ;
25+ } ) ;
26+ process . on ( "SIGINT" , function ( ) {
27+ server . stop ( ) ;
28+ process . exit ( 0 ) ;
29+ } ) ;
30+ } ) ( ) . catch ( console . error ) ;
0 commit comments