UNPKG

node-radio-mini

Version:

A terminal based radio streaming solution made entirely in Node.js

38 lines (29 loc) 765 B
#!/usr/bin/env node 'use strict'; require('dotenv').config(); const Path = require('path'); const Hapi = require('hapi'); const StreamRoutes = require('./routes'); const { startEngine } = require('./engine.js'); const server = Hapi.server({ port: process.env.PORT || 8080, host: process.env.HOST || 'localhost', compression: false, routes: { files: { relativeTo: Path.join(__dirname, 'public') } } }); void async function startApp() { try { await server.register(StreamRoutes); startEngine(); console.log(`Server running at ${server.info.uri}`); await server.start(); } catch (err) { console.log(`Server error: ${err}`); process.exit(1); } }();