express-api-base/app.js
2024-06-28 11:20:46 +02:00

27 lines
724 B
JavaScript

'use strict'
// Dependencies
const axios = require('axios')
const path = require('path')
// Environment
const env_path = path.join(__dirname, '.env' + (process.env.DEBUG == '1' ? '.development.local' : ''))
require('dotenv').config({ path: env_path, debug: process.env.DEBUG, encode: 'utf8', override: true })
// Axios setup
const http = require('http')
const https = require('https')
const { encode } = require('punycode')
axios.create({
timeout: 60000,
httpAgent: new http.Agent({ keepAlive: true }),
httpsAgent: new https.Agent({ keepAlive: true }),
maxRedirects: 10,
maxContentLength: 50 * 1000 * 1000
})
// Start API server
require('./router')
// Start example service
require('./services/example').run()