index.js 442 B

1234567891011121314151617181920212223
  1. const Hapi = require('@hapi/hapi');
  2. const Database = require('./config/database');
  3. const init = async () => {
  4. const server = Hapi.server({
  5. port: 8000,
  6. host: 'localhost'
  7. });
  8. Database.connect();
  9. await server.register([
  10. // { plugin: require('./routes/posts') },
  11. { plugin: require('./routes/index') },
  12. ]);
  13. await server.start();
  14. console.log('Listening on %s', server.info.uri);
  15. }
  16. init();