From 495557e6c2a9b802b8e1d65d8e839314f0bf9883 Mon Sep 17 00:00:00 2001 From: xeruf <27jf@pm.me> Date: Thu, 7 Nov 2024 10:28:11 +0100 Subject: [PATCH] refactor: add starter script --- app.js | 6 ++++++ package.json | 10 +++++----- server.js | 9 --------- 3 files changed, 11 insertions(+), 14 deletions(-) create mode 100644 app.js diff --git a/app.js b/app.js new file mode 100644 index 0000000..217a7e6 --- /dev/null +++ b/app.js @@ -0,0 +1,6 @@ +import server from './server.js'; + +const port = process.env.NODE_PORT || 3000; +server.listen(port, () => { + console.log(`Server started on port ${port}`); +}); diff --git a/package.json b/package.json index 585b394..def9d85 100644 --- a/package.json +++ b/package.json @@ -1,9 +1,8 @@ { "name": "calendar-merger", - "version": "1.0.0", - "type": "module", + "version": "1.1.0", "scripts": { - "start": "node server.js", + "start": "node app.js", "test": "jest ./test" }, "dependencies": { @@ -16,8 +15,9 @@ "node-cron": "^2.0.3", "supertest": "^7.0.0" }, - "description": "cal merge", - "main": "script.js", + "description": "calmerger", + "main": "server.js", + "type": "module", "author": "Ryan", "license": "ISC", "devDependencies": { diff --git a/server.js b/server.js index c352a0d..db2a6c5 100644 --- a/server.js +++ b/server.js @@ -234,13 +234,4 @@ function saveCalendarData(calendarId, linkGroupName, calendars) { } } -// Start the server -if (process.env.NODE_ENV !== 'test') { - const port = 3000; - app.listen(port, () => { - console.log(`Server started on port ${port}`); - }); -} - - export default app;