repl.it
@Kognise/

Omega

Nodejs

No description

fork
loading
Files
  • index.js
  • Packager files
  • package-lock.json
  • package.json
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
const express = require('express')
const fileUpload = require('express-fileupload')
const bearerToken = require('express-bearer-token')
const admin = require('firebase-admin')

const app = express()

app.use(bearerToken())
app.use(fileUpload({
  limits: { files: 1 },
  debug: true
}))

app.post('/upload', (req, res) => {
  console.log('owo', req.files.file)
  admin.storage().bucket().file(`kognise/${req.files.file.name}`).save(req.files.file.data, {
    gzip: true,
    metadata: {
      cacheControl: 'public, max-age=31536000',
    },
  })
  res.end()
})

app.listen(() => console.log('Ready'))
Fetching token
?