@@ -12,32 +12,29 @@ const app = express();
12
12
// Serve static assets from the /public folder
13
13
app . use ( '/public' , express . static ( path . join ( __dirname , '/public' ) ) ) ;
14
14
15
+ // Parse Server plays nicely with the rest of your web routes
16
+ app . get ( '/' , function ( req , res ) {
17
+ res . status ( 200 ) . send ( 'I dream of being a website. Please star the parse-server repo on GitHub!' ) ;
18
+ } ) ;
19
+
20
+ // There will be a test page available on the /test path of your server url
21
+ // Remove this before launching your app
22
+ app . get ( '/test' , function ( req , res ) {
23
+ res . sendFile ( path . join ( __dirname , '/public/test.html' ) ) ;
24
+ } ) ;
25
+
15
26
// Serve the Parse API on the /parse URL prefix
16
27
const mountPath = process . env . PARSE_MOUNT || '/parse' ;
17
28
const server = new ParseServer ( config ) ;
18
29
19
- server . start ( ) . then ( ( ) => {
30
+ server . start ( ) . then ( async ( ) => {
20
31
app . use ( mountPath , server . app ) ;
21
-
22
- // Parse Server plays nicely with the rest of your web routes
23
- app . get ( '/' , function ( req , res ) {
24
- res
25
- . status ( 200 )
26
- . send ( 'I dream of being a website. Please star the parse-server repo on GitHub!' ) ;
27
- } ) ;
28
-
29
- // There will be a test page available on the /test path of your server url
30
- // Remove this before launching your app
31
- app . get ( '/test' , function ( req , res ) {
32
- res . sendFile ( path . join ( __dirname , '/public/test.html' ) ) ;
33
- } ) ;
34
-
35
32
const port = process . env . PORT || 1337 ;
36
33
const httpServer = http . createServer ( app ) ;
37
34
httpServer . listen ( port , function ( ) {
38
35
console . log ( 'parse-server-example running on port ' + port + '.' ) ;
39
36
} ) ;
40
- // This will enable the Live Query real-time server
41
37
console . log ( `Visit http://localhost:${ port } /test to check the Parse Server` ) ;
42
- return ParseServer . createLiveQueryServer ( httpServer ) ;
38
+ // This will enable the Live Query real-time server
39
+ await ParseServer . createLiveQueryServer ( httpServer ) ;
43
40
} ) ;
0 commit comments