Skip to content
Permalink
Browse files

move to firebase + zeit

  • Loading branch information
impronunciable committed Oct 9, 2019
1 parent 3f293ea commit b8fe814c90f601679cf32fe022280f3bbf77d3a1
Showing with 8,457 additions and 2,477 deletions.
  1. +1 −11 .gitignore
  2. +0 −105 api.js
  3. +1 −0 api/.gitignore
  4. +42 −0 api/assets/search.js
  5. +1,393 −0 api/package-lock.json
  6. +17 −0 api/package.json
  7. +16 −0 api/preview.js
  8. +56 −0 api/stories.js
  9. +39 −0 api/story.js
  10. +0 −17 auth.js
  11. +2 −1 client/.babelrc
  12. +3 −1 client/.gitignore
  13. +6 −1 client/config.sample.json
  14. 0 {public → client/dist}/Monoid.fnt
  15. BIN {public → client/dist}/Monoid.png
  16. BIN {public → client/dist}/favicon.ico
  17. BIN {public → client/dist}/images/a-loves-b.png
  18. BIN {public → client/dist}/images/chart_tmpl.png
  19. BIN {public → client/dist}/images/pano_tmpl.png
  20. BIN {public → client/dist}/images/videosphere_tmpl.png
  21. BIN {public → client/dist}/images/voiceover_tmpl.png
  22. BIN {public → client/dist}/logo.png
  23. 0 {public → client/dist}/logo.svg
  24. 0 {public → client/dist}/manifest.json
  25. 0 {public → client/dist}/styles.css
  26. 0 {public → client/dist}/translations/en.json
  27. 0 {public → client/dist}/translations/es.json
  28. 0 {public → client/dist}/uploads/.gitkeep
  29. 0 {public → client/dist}/uploads/s/.gitkeep
  30. +6,718 −0 client/package-lock.json
  31. +4 −0 client/package.json
  32. +3 −3 client/src/components/StoryCard.js
  33. +3 −3 client/src/components/StoryList.js
  34. +43 −0 client/src/index.ejs
  35. +2 −3 client/src/index.js
  36. +45 −32 client/src/services/datalayer.js
  37. +23 −9 client/src/services/guri.js
  38. +9 −3 client/webpack.config.dev.js
  39. +7 −0 client/webpack.config.js
  40. +0 −23 config.sample.json
  41. +0 −4 db.js
  42. +0 −47 index.js
  43. +0 −7 mailer.js
  44. +24 −0 now.json
  45. +0 −35 package.json
  46. +0 −3 public/bmfont.js
  47. +0 −46 search-resources.js
  48. +0 −63 uploader/fs.js
  49. +0 −12 uploader/index.js
  50. +0 −74 uploader/s3.js
  51. +0 −39 views/index.pug
  52. +0 −1,935 yarn.lock
@@ -1,11 +1 @@
node_modules
.DS_Store
config.json
npm-debug.log
public/app.js
public/*.app.js
public/uploads/*
!public/uploads/.gitkeep
!public/uploads/s
public/uploads/s/*
!public/uploads/s/.gitkeep
.env
105 api.js

This file was deleted.

@@ -0,0 +1 @@
node_modules
@@ -0,0 +1,42 @@
/**
* Module dependencies
*/

const axios = require('axios');

/**
* Module constants
*/

const FLICKR_BASE_URL = 'https://api.flickr.com/services/rest/?method=flickr.photos.search'
const FLICKR_PARAMS = `&per_page=5&license=1,2,3,4,5,6,7&format=json&nojsoncallback=1&extras=url_o,url_k,url_t&api_key=${process.env.FLICKR_SECRET_KEY}`
const FREESOUND_BASE_URL = 'http://www.freesound.org/apiv2'

module.exports = (req, res) => {
const { type, query } = req.query

switch (type) {
case 'image':
axios.get(`${FLICKR_BASE_URL}${FLICKR_PARAMS}&text=${query}`)
.then(({ data }) => res.json(data.photos.photo))
.catch(() => res.status(500).send('error'))
break
case 'panorama':
default:
axios.get(`${FLICKR_BASE_URL}${FLICKR_PARAMS}&group_id=44671723@N00&text=${query}`)
.then(({ data }) => res.json(data.photos.photo))
.catch(() => res.status(500).send('error'))
break
case 'audio':
axios.get(`${FREESOUND_BASE_URL}/search/text/?query=${query}&token=${process.env.FREESOUND_SECRET_KEY}`)
.then(({ data }) => {
if (!data.length) return ''

fetch(`${FREESOUND_BASE_URL}/sounds/${results[0].id}/?token=${process.env.FREESOUND_SECRET_KEY}`)
.then(({ data }) => res.json(data.previews['preview-hq-mp3'].replace('http://', 'https://')))
.catch(() => res.status(500).send('error'))
})
.catch(() => res.status(500).send('error'))
break
}
}

0 comments on commit b8fe814

Please sign in to comment.
You can’t perform that action at this time.