mirror of
https://github.com/stronk-dev/RandomChad.git
synced 2025-07-05 10:35:08 +02:00
use express
This commit is contained in:
parent
3f7cc34585
commit
0bfaedb6f8
@ -13,10 +13,6 @@
|
||||
"target": "website",
|
||||
"public": "website/docs",
|
||||
"rewrites": [
|
||||
{
|
||||
"source": "/api/integrations/avatar",
|
||||
"function": "setAvatarOfValidtor"
|
||||
},
|
||||
{
|
||||
"source": "/api/**",
|
||||
"function": "mainnetMetadata"
|
||||
|
@ -1,7 +1,6 @@
|
||||
const functions = require( 'firebase-functions' )
|
||||
const testnetAPI = require( './modules/testnet' )
|
||||
const mainnetAPI = require( './modules/mainnet' )
|
||||
const setAvatarOfValidtor = require( './integrations/avatar' )
|
||||
|
||||
// Runtime config
|
||||
const runtime = {
|
||||
@ -14,8 +13,3 @@ exports.testnetMetadata = functions.runWith( runtime ).https.onRequest( testnetA
|
||||
|
||||
// Mainnet endpoint
|
||||
exports.mainnetMetadata = functions.runWith( runtime ).https.onRequest( mainnetAPI )
|
||||
|
||||
/* ///////////////////////////////
|
||||
// Integrations
|
||||
// /////////////////////////////*/
|
||||
exports.setAvatarOfValidtor = functions.https.onRequest( setAvatarOfValidtor )
|
@ -70,7 +70,7 @@ module.exports = async function( req, res ) {
|
||||
|
||||
console.log( 'New data: ', cachedJson )
|
||||
|
||||
return res.send( {
|
||||
return res.json( {
|
||||
success: true,
|
||||
url: cacheFile.publicUrl()
|
||||
} )
|
||||
@ -78,7 +78,7 @@ module.exports = async function( req, res ) {
|
||||
} catch( e ) {
|
||||
|
||||
console.error( 'avatar integration error: ', e )
|
||||
return res.send( {
|
||||
return res.json( {
|
||||
error: e.message
|
||||
} )
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
const app = require( './express' )()
|
||||
const { getTotalSupply } = require( './contract' )
|
||||
const { safelyReturnRocketeer, web2domain } = require( './rocketeer' )
|
||||
const setAvatarOfValidtor = require( '../integrations/avatar' )
|
||||
|
||||
|
||||
// ///////////////////////////////
|
||||
@ -32,6 +33,8 @@ app.get( '/api/rocketeer/:id', async ( req, res ) => {
|
||||
|
||||
} )
|
||||
|
||||
app.post( '/api/integrations/', setAvatarOfValidtor )
|
||||
|
||||
|
||||
// ///////////////////////////////
|
||||
// Static collection data
|
||||
|
Loading…
x
Reference in New Issue
Block a user