29 lines
755 B
JavaScript
29 lines
755 B
JavaScript
import express from 'express';
|
|
import bodyParser from 'body-parser';
|
|
import helmet from 'helmet';
|
|
import cookieParser from 'cookie-parser';
|
|
import dotenv from 'dotenv';
|
|
import path from 'path';
|
|
import { fileURLToPath } from 'url';
|
|
dotenv.config();
|
|
|
|
import webhookRouter from './routes/webhook.js';
|
|
import execRouter from './routes/exec.js';
|
|
|
|
import { info } from './util/Console.js';
|
|
|
|
const app = express();
|
|
app.use(helmet());
|
|
app.use(bodyParser.json());
|
|
app.use(cookieParser());
|
|
app.use(express.static('public'));
|
|
|
|
app.use('/webhook', webhookRouter);
|
|
app.use('/exec', execRouter);
|
|
|
|
const PORT = process.env.PORT || 3000;
|
|
const HOST = process.env.BIND_ADDRESS || '0.0.0.0';
|
|
|
|
app.listen(PORT, HOST, () => {
|
|
info(`API listening on ${HOST}:${PORT}`);
|
|
}); |