1+ //modules
2+ import unocss from 'unocss/vite' ;
3+ //stackpress
4+ import { server as http } from 'stackpress/http' ;
5+ //config
6+ import type { Config } from './common.js' ;
7+ import * as common from './common.js' ;
8+
9+ export const config : Config = {
10+ server : {
11+ ...common . server ,
12+ mode : 'development'
13+ } ,
14+ view : {
15+ ...common . view ,
16+ //reactus specific settings
17+ engine : {
18+ //base path (used in vite)
19+ basePath : '/' ,
20+ //client script route prefix used in the document markup
21+ //ie. /client/[id][extname]
22+ //<script type="module" src="/client/[id][extname]"></script>
23+ //<script type="module" src="/client/abc123.tsx"></script>
24+ clientRoute : '/client' ,
25+ //filepath to a global css file
26+ cssFiles : [
27+ 'frui/frui.css' ,
28+ 'stackpress/stackpress.css' ,
29+ 'virtual:uno.css'
30+ ] ,
31+ //vite plugins
32+ plugins : [ unocss ( ) ]
33+ }
34+ } ,
35+ session : {
36+ ...common . session ,
37+ access : {
38+ GUEST : [
39+ ...common . session . access . GUEST ,
40+ //dev routes
41+ { method : 'ALL' , route : '/@vite/client' } ,
42+ { method : 'ALL' , route : '/@react-refresh' } ,
43+ { method : 'ALL' , route : '/@fs/**' } ,
44+ { method : 'ALL' , route : '/node_modules/**' } ,
45+ { method : 'ALL' , route : '/__uno.css' } ,
46+ { method : 'ALL' , route : '/plugins/**' } ,
47+ { method : 'ALL' , route : '/react.svg' } ,
48+ //public routes
49+ { method : 'GET' , route : '/assets/**' } ,
50+ { method : 'GET' , route : '/client/**' } ,
51+ { method : 'GET' , route : '/images/**' } ,
52+ { method : 'GET' , route : '/styles/**' } ,
53+ { method : 'GET' , route : '/favicon.ico' } ,
54+ { method : 'GET' , route : '/favicon.png' } ,
55+ ]
56+ }
57+ } ,
58+ brand : common . brand ,
59+ cli : common . cli ,
60+ cookie : common . cookie ,
61+ language : common . language
62+ } ;
63+
64+ export async function bootstrap ( ) {
65+ //make a server
66+ const server = http ( ) ;
67+ //set config
68+ server . config . set ( config ) ;
69+ //load the plugins
70+ await server . bootstrap ( ) ;
71+ //initialize the plugins
72+ await server . resolve ( 'config' ) ;
73+ //add events
74+ await server . resolve ( 'listen' ) ;
75+ //add routes
76+ await server . resolve ( 'route' ) ;
77+ //return the server
78+ return server ;
79+ } ;
0 commit comments