@@ -12,32 +12,29 @@ const app = express();
1212// Serve static assets from the /public folder
1313app . use ( '/public' , express . static ( path . join ( __dirname , '/public' ) ) ) ;
1414
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+
1526// Serve the Parse API on the /parse URL prefix
1627const mountPath = process . env . PARSE_MOUNT || '/parse' ;
1728const server = new ParseServer ( config ) ;
1829
19- server . start ( ) . then ( ( ) => {
30+ server . start ( ) . then ( async ( ) => {
2031 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-
3532 const port = process . env . PORT || 1337 ;
3633 const httpServer = http . createServer ( app ) ;
3734 httpServer . listen ( port , function ( ) {
3835 console . log ( 'parse-server-example running on port ' + port + '.' ) ;
3936 } ) ;
40- // This will enable the Live Query real-time server
4137 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 ) ;
4340} ) ;
0 commit comments