refactor: add starter script

This commit is contained in:
xeruf 2024-11-07 10:28:11 +01:00
parent 5b3a47a122
commit 495557e6c2
3 changed files with 11 additions and 14 deletions

6
app.js Normal file
View File

@ -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}`);
});

View File

@ -1,9 +1,8 @@
{ {
"name": "calendar-merger", "name": "calendar-merger",
"version": "1.0.0", "version": "1.1.0",
"type": "module",
"scripts": { "scripts": {
"start": "node server.js", "start": "node app.js",
"test": "jest ./test" "test": "jest ./test"
}, },
"dependencies": { "dependencies": {
@ -16,8 +15,9 @@
"node-cron": "^2.0.3", "node-cron": "^2.0.3",
"supertest": "^7.0.0" "supertest": "^7.0.0"
}, },
"description": "cal merge", "description": "calmerger",
"main": "script.js", "main": "server.js",
"type": "module",
"author": "Ryan", "author": "Ryan",
"license": "ISC", "license": "ISC",
"devDependencies": { "devDependencies": {

View File

@ -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; export default app;