move folder check
parent
5f5f48d42e
commit
42e2973627
|
@ -1,9 +1,14 @@
|
||||||
|
import fs from 'fs';
|
||||||
import { verbose } from "sqlite3";
|
import { verbose } from "sqlite3";
|
||||||
import { validate as validateEmailAddress } from 'email-validator';
|
import { validate as validateEmailAddress } from 'email-validator';
|
||||||
import Database from "./index";
|
import Database from "./index";
|
||||||
|
|
||||||
const sqlite3 = verbose();
|
const sqlite3 = verbose();
|
||||||
|
|
||||||
|
if (!fs.existsSync('./data')) {
|
||||||
|
fs.mkdirSync('./data');
|
||||||
|
}
|
||||||
|
|
||||||
const db = new sqlite3.Database('./data/chat.sqlite');
|
const db = new sqlite3.Database('./data/chat.sqlite');
|
||||||
|
|
||||||
// interface ChatRow {
|
// interface ChatRow {
|
||||||
|
|
|
@ -95,12 +95,8 @@ export default class ChatServer {
|
||||||
}
|
}
|
||||||
|
|
||||||
async initialize() {
|
async initialize() {
|
||||||
if (!fs.existsSync('./data')) {
|
await this.objectStore.initialize();
|
||||||
fs.mkdirSync('./data');
|
await this.database.initialize();
|
||||||
}
|
|
||||||
|
|
||||||
await this.objectStore.initialize();;
|
|
||||||
await this.database.initialize();;
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
this.app.listen(port, () => {
|
this.app.listen(port, () => {
|
||||||
|
|
|
@ -1,8 +1,13 @@
|
||||||
|
import fs from 'fs';
|
||||||
import { verbose } from "sqlite3";
|
import { verbose } from "sqlite3";
|
||||||
import ObjectStore from "./index";
|
import ObjectStore from "./index";
|
||||||
|
|
||||||
const sqlite3 = verbose();
|
const sqlite3 = verbose();
|
||||||
|
|
||||||
|
if (!fs.existsSync('./data')) {
|
||||||
|
fs.mkdirSync('./data');
|
||||||
|
}
|
||||||
|
|
||||||
const db = new sqlite3.Database('./data/object-store.sqlite');
|
const db = new sqlite3.Database('./data/object-store.sqlite');
|
||||||
|
|
||||||
export interface StoredObject {
|
export interface StoredObject {
|
||||||
|
|
Loading…
Reference in New Issue