text: const express = require('express');
  const cors = require('cors');
  const mongoose = require('mongoose');
  
  // express init 
  
  const app = express();
  app.use(express.json());
  app.use(cors());
  
  // use routs
  
  app.use('/api/users', require('./routes/api/users'));
  app.use('/api/dev', require('./routes/api/dev'))
  app.use('/api/goods', require('./routes/api/goods'))
  app.use('/api/auth', require('./routes/api/auth'))
  app.use('/api/transactions', require('./routes/api/transaction'))
  app.use('/api/logs', require('./routes/api/logs'))
  
  // db config
  
  const dbConnData = require('./config/default.json')
  
  // connect to Mongo
  
  mongoose
    .connect(`mongodb://${dbConnData.host}:${dbConnData.port}/${dbConnData.database}`, {
      useNewUrlParser: true,
      useUnifiedTopology: true,
      useFindAndModify: false,
      useCreateIndex: true
    })
    .then(response => console.log(`Connected to MongoDB. Database name: "${response.connections[0].name}"`))
    .catch(error => console.error('Error connecting to MongoDB', error));
  
  // server listen
  
  const PORT = 5000
  
  app.listen(PORT, () => {
    console.log(`Server started at http://localhost:${PORT}`);
  });