app.js 543 Bytes
const express = require('express');
const app = express();

const config = require('./common/config');

const logger = require('yoho-node-lib/lib/logger').init(config);

global.yoho = {
    logger,
    config
};

const middleware = require('./middleware');

app.get('/yas.gif', middleware.apm);

app.use('*', (req, res) => {
    res.statusCode = 404;
    res.send();
});
app.use((err, req, res) => {
    logger.error('error:', err);
    res.send();
});

app.listen(config.port, () => {
    logger.info(`yoho apm start at ${config.port}`);
});