@@ -207,17 +207,7 @@ routes.get('/networks', async (req, res) => {
207207
208208routes . get ( '/apps' , async ( req , res ) => {
209209 const { flat} = req . query ;
210- let apps = await AppService . getApps ( ) ;
211- if ( flat ) {
212- apps = flattenBlockchainObject ( apps ) ;
213- apps = apps . map ( app => {
214- const a = JSON . parse ( JSON . stringify ( app ) ) ;
215- a . url = ReflinkService . withRefLink ( a . url , a . applink ) ;
216- return a ;
217- } ) ;
218- }
219-
220- returnResult ( apps , req , res ) ;
210+ returnResult ( flat ? await AppService . getFlatApps ( ) : AppService . getApps ( ) , req , res ) ;
221211} ) ;
222212
223213routes . get ( '/apps/featured' , async ( req , res ) => {
@@ -226,9 +216,9 @@ routes.get('/apps/featured', async (req, res) => {
226216
227217routes . post ( '/apps' , async ( req , res ) => {
228218 const { apps} = req . body ;
229- let allApps = await AppService . getApps ( ) ;
219+ let allApps = await AppService . getFlatApps ( ) ;
230220 if ( ! apps || ! apps . length ) return returnResult ( allApps , req , res ) ;
231- const result = flattenBlockchainObject ( allApps ) . filter ( x => apps . includes ( x . applink ) ) ;
221+ const result = allApps . filter ( x => apps . includes ( x . applink ) ) ;
232222 returnResult ( result , req , res ) ;
233223} ) ;
234224
0 commit comments