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",
|
"target": "website",
|
||||||
"public": "website/docs",
|
"public": "website/docs",
|
||||||
"rewrites": [
|
"rewrites": [
|
||||||
{
|
|
||||||
"source": "/api/integrations/avatar",
|
|
||||||
"function": "setAvatarOfValidtor"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"source": "/api/**",
|
"source": "/api/**",
|
||||||
"function": "mainnetMetadata"
|
"function": "mainnetMetadata"
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
const functions = require( 'firebase-functions' )
|
const functions = require( 'firebase-functions' )
|
||||||
const testnetAPI = require( './modules/testnet' )
|
const testnetAPI = require( './modules/testnet' )
|
||||||
const mainnetAPI = require( './modules/mainnet' )
|
const mainnetAPI = require( './modules/mainnet' )
|
||||||
const setAvatarOfValidtor = require( './integrations/avatar' )
|
|
||||||
|
|
||||||
// Runtime config
|
// Runtime config
|
||||||
const runtime = {
|
const runtime = {
|
||||||
@ -14,8 +13,3 @@ exports.testnetMetadata = functions.runWith( runtime ).https.onRequest( testnetA
|
|||||||
|
|
||||||
// Mainnet endpoint
|
// Mainnet endpoint
|
||||||
exports.mainnetMetadata = functions.runWith( runtime ).https.onRequest( mainnetAPI )
|
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 )
|
console.log( 'New data: ', cachedJson )
|
||||||
|
|
||||||
return res.send( {
|
return res.json( {
|
||||||
success: true,
|
success: true,
|
||||||
url: cacheFile.publicUrl()
|
url: cacheFile.publicUrl()
|
||||||
} )
|
} )
|
||||||
@ -78,7 +78,7 @@ module.exports = async function( req, res ) {
|
|||||||
} catch( e ) {
|
} catch( e ) {
|
||||||
|
|
||||||
console.error( 'avatar integration error: ', e )
|
console.error( 'avatar integration error: ', e )
|
||||||
return res.send( {
|
return res.json( {
|
||||||
error: e.message
|
error: e.message
|
||||||
} )
|
} )
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
const app = require( './express' )()
|
const app = require( './express' )()
|
||||||
const { getTotalSupply } = require( './contract' )
|
const { getTotalSupply } = require( './contract' )
|
||||||
const { safelyReturnRocketeer, web2domain } = require( './rocketeer' )
|
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
|
// Static collection data
|
||||||
|
Loading…
x
Reference in New Issue
Block a user