• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Nikorag / iplayarr / 14751376880

30 Apr 2025 09:30AM UTC coverage: 45.05% (+3.3%) from 41.731%
14751376880

push

github

web-flow
Merge pull request #127 from Nikorag/126-native-schedule

Schedule Facade and Native Schedule Service

226 of 574 branches covered (39.37%)

Branch coverage included in aggregate %.

117 of 127 new or added lines in 12 files covered. (92.13%)

2 existing lines in 2 files now uncovered.

866 of 1850 relevant lines covered (46.81%)

6.06 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/server.ts
1
import 'module-alias/register';
×
2

3
import cors from 'cors';
×
4
import express, { Express, NextFunction, Request, Response } from 'express';
×
5
import http, { Server } from 'http';
×
6
import path from 'path';
×
7
import { Server as SocketIOServer } from 'socket.io';
×
8

9
import ApiRoute from './routes/ApiRoute';
×
10
import AuthRoute, { addAuthMiddleware } from './routes/AuthRoute';
×
11
import JsonApiRoute from './routes/JsonApiRoute';
×
12
import loggingService from './service/loggingService';
×
13
import socketService from './service/socketService';
×
NEW
14
import taskService from './service/taskService';
×
UNCOV
15
import { IplayarrParameter } from './types/IplayarrParameters';
×
16

17
const isDebug = process.env.DEBUG == 'true';
×
18

19
const app: Express = express();
×
20
const port: number = parseInt(process.env[IplayarrParameter.PORT.toString()] || '4404');
×
21

22
if (isDebug) {
×
23
    app.use(
×
24
        cors({
25
            origin: (origin, callback) => {
26
                callback(null, origin);
×
27
            },
28
            credentials: true,
29
        })
30
    );
31
}
32

33
// Session and Auth
34
app.use(express.json());
×
35
addAuthMiddleware(app);
×
36
app.use('/auth', AuthRoute);
×
37

38
app.use(express.static(path.join(process.cwd(), 'frontend', 'dist')));
×
39

40
// Middleware
41
app.use((req: Request, _: Response, next: NextFunction) => {
×
42
    loggingService.debug('Request received:');
×
43
    loggingService.debug('Method:', req.method);
×
44
    loggingService.debug('URL:', req.url);
×
45
    loggingService.debug('Headers:', req.headers);
×
46
    loggingService.debug('Body:', req.body);
×
47
    next();
×
48
});
49

50
// Routes
51
app.use('/api', ApiRoute);
×
52
app.use('/json-api', JsonApiRoute);
×
53
app.get('*', (req, res) => {
×
54
    res.sendFile(path.join(process.cwd(), 'frontend', 'dist', 'index.html'));
×
55
});
56

57
// Start the server
58
const server: Server = http.createServer(app);
×
59

60
const io = isDebug ? new SocketIOServer(server, { cors: {} }) : new SocketIOServer(server);
×
61
socketService.registerIo(io);
×
62

63
server.listen(port, () => {
×
64
    loggingService.log(`Server running at http://localhost:${port}`);
×
65
});
66

67
//Cron
68
taskService.init();
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc