1
- const express = require ( 'express' ) ;
2
- const { default : ParseServer , ParseGraphQLServer } = require ( 'parse-server' ) ;
3
- const ParseDashboard = require ( 'parse-dashboard' ) ;
4
- const db = require ( " ./database" ) ;
1
+ import * as express from 'express' ;
2
+ import ParseServer , { ParseGraphQLServer } from 'parse-server' ;
3
+ import * as ParseDashboard from 'parse-dashboard' ;
4
+ import db from ' ./database' ;
5
5
6
- let app = express ( ) ;
7
- let parseArray = process . env . APP_IDS . split ( ',' ) ;
8
- let liveQueryArray = process . env . LIVE_QUERIES . split ( '|' ) ;
9
- let dashboardArray = [ ] ;
6
+ const app = express ( ) ;
7
+ const parseArray = process . env . APP_IDS ? process . env . APP_IDS . split ( ',' ) : [ ] ;
8
+ const liveQueryArray = process . env . LIVE_QUERIES ? process . env . LIVE_QUERIES . split ( '|' ) : [ ] ;
9
+ const dashboardArray : unknown [ ] = [ ] ;
10
10
11
11
// Parse Server
12
12
parseArray . forEach ( appId => {
@@ -19,8 +19,8 @@ parseArray.forEach(appId => {
19
19
} ) ;
20
20
21
21
// Live Query configuration
22
- let liveQueryClasses = liveQueryArray . reduce ( ( res , value ) => {
23
- let prefix = `${ appId } :` ;
22
+ const liveQueryClasses = liveQueryArray . reduce ( ( res , value ) => {
23
+ const prefix = `${ appId } :` ;
24
24
if ( value . startsWith ( prefix ) ) res = res . concat ( value . replace ( prefix , '' ) . split ( ',' ) ) ;
25
25
return res ;
26
26
} , [ ] ) ;
@@ -45,7 +45,7 @@ parseArray.forEach(appId => {
45
45
} ) ;
46
46
47
47
// Parse Dashboard
48
- let dashboard = new ParseDashboard ( {
48
+ const dashboard = new ParseDashboard ( {
49
49
'apps' : dashboardArray ,
50
50
'users' : [ {
51
51
'user' : process . env . DASHBOARD_USERNAME ,
@@ -60,5 +60,5 @@ app.use('/dashboard/', dashboard);
60
60
// Parse Server plays nicely with the rest of your web routes
61
61
app . get ( '/' , ( req , res ) => res . status ( 200 ) . send ( 'Welcome to the Parse Server' ) ) ;
62
62
63
- let port = process . env . PORT || 1337 ;
64
- app . listen ( port , ( ) => console . log ( `Parse Server is running on port ${ port } .` ) ) ;
63
+ const port = process . env . PORT || 1337 ;
64
+ app . listen ( port , ( ) => console . log ( `Parse Server is running on port ${ port } .` ) ) ;
0 commit comments