feat: add app serve
This commit is contained in:
		| @@ -5,6 +5,9 @@ import fs from 'fs'; | ||||
| const envisionPath = path.join(os.homedir(), '.config', 'envision'); | ||||
| const configPath = path.join(os.homedir(), '.config', 'envision', 'config.json'); | ||||
|  | ||||
| export const pidFilePath = path.join(envisionPath, 'app.pid'); | ||||
| export const dbPath = path.join(envisionPath, 'db.sqlite'); | ||||
|  | ||||
| export const checkFileExists = (filePath: string) => { | ||||
|   try { | ||||
|     fs.accessSync(filePath, fs.constants.F_OK); | ||||
|   | ||||
							
								
								
									
										13
									
								
								src/module/sequelize.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								src/module/sequelize.ts
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,13 @@ | ||||
| import { Sequelize } from 'sequelize'; | ||||
| import { dbPath } from './get-config.ts'; | ||||
| // connect to db | ||||
| export const sequelize = new Sequelize({ | ||||
|   dialect: 'sqlite', | ||||
|   // storage: 'db.sqlite', | ||||
|   storage: dbPath, | ||||
|   // logging: false, | ||||
| }); | ||||
|  | ||||
| sequelize.authenticate({ logging: false }).then(() => { | ||||
|   console.log('Connection sqlite has been established successfully.'); | ||||
| }); | ||||
		Reference in New Issue
	
	Block a user