27 lines
702 B
JavaScript
27 lines
702 B
JavaScript
const express = require('express');
|
|
const path = require('path');
|
|
const config = require('./config');
|
|
|
|
const app = express();
|
|
|
|
// Body parsing
|
|
app.use(express.urlencoded({ extended: true }));
|
|
app.use(express.json());
|
|
app.use(express.text({ type: ['text/xml', 'application/xml'] }));
|
|
|
|
// Static files
|
|
app.use(express.static(path.join(__dirname, 'public')));
|
|
|
|
// View engine
|
|
app.set('view engine', 'ejs');
|
|
app.set('views', path.join(__dirname, 'views'));
|
|
|
|
// Routes
|
|
app.use('/', require('./routes/index'));
|
|
app.use('/pay', require('./routes/pay'));
|
|
|
|
// Start server
|
|
app.listen(config.server.port, config.server.host, () => {
|
|
console.log(`Server running at http://localhost:${config.server.port}`);
|
|
});
|