24 lines
		
	
	
		
			629 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
			
		
		
	
	
			24 lines
		
	
	
		
			629 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
| import api from './app';
 | |
| import { middlewares } from '@nocobase/server';
 | |
| 
 | |
| (async () => {
 | |
|   api.resourcer.use(middlewares.actionParams());
 | |
| 
 | |
|   await api.loadPlugins();
 | |
| 
 | |
|   if (process.env.NOCOBASE_ENV === 'demo') {
 | |
|     api.resourcer.use(middlewares.demoBlacklistedActions({
 | |
|       emails: [process.env.ADMIN_EMAIL],
 | |
|     }));
 | |
|   }
 | |
| 
 | |
|   api.use(middlewares.appDistServe({
 | |
|     root: process.env.APP_DIST,
 | |
|     useStaticServer: !(process.env.APP_USE_STATIC_SERVER === 'false' || !process.env.APP_USE_STATIC_SERVER),
 | |
|   }));
 | |
| 
 | |
|   api.listen(process.env.API_PORT, () => {
 | |
|     console.log(`http://localhost:${process.env.API_PORT}/`);
 | |
|   });
 | |
| })();
 |