index.js 469 B

12345678910111213141516171819
  1. 'use strict'
  2. import express from 'express'
  3. import routes from './routes'
  4. import { errorHandler } from './functions'
  5. import { apiConfig } from '../config'
  6. const app = express()
  7. app.listen(apiConfig.port, () => {
  8. console.log('The server was started on http://localhost:' + apiConfig.port)
  9. })
  10. // Load all the routes in the server
  11. app.use(apiConfig.routePrefix, routes)
  12. // Error handler (Middleware called when throwing in another middleware)
  13. app.use(errorHandler)