routes.js 787 B

123456789101112131415161718192021
  1. const choo = require('choo');
  2. const download = require('./ui/download');
  3. const body = require('./ui/body');
  4. module.exports = function(app = choo({ hash: true })) {
  5. app.route('/', body(require('./ui/home')));
  6. app.route('/download/:id', body(download));
  7. app.route('/download/:id/:key', body(download));
  8. app.route('/unsupported/:reason', body(require('./ui/unsupported')));
  9. app.route('/error', body(require('./ui/error')));
  10. app.route('/blank', body(require('./ui/blank')));
  11. app.route('/oauth', function(state, emit) {
  12. emit('authenticate', state.query.code, state.query.state);
  13. });
  14. app.route('/login', function(state, emit) {
  15. emit('replaceState', '/');
  16. setTimeout(() => emit('render'));
  17. });
  18. app.route('*', body(require('./ui/notFound')));
  19. return app;
  20. };