23 lines
648 B
JavaScript
23 lines
648 B
JavaScript
import express from 'express'
|
|
import dotenv from 'dotenv'
|
|
import api from './api/api.js'
|
|
import { generateDB } from "./libs/db/generate.js"
|
|
import { sqlite, dbInit } from "./libs/db/init.js"
|
|
import { ddnssStart, scrapeServer } from './libs/ddnss/handler.js'
|
|
//import tasks from './db/tasks.js'
|
|
|
|
dotenv.config()
|
|
|
|
dbInit()
|
|
|
|
const exists = sqlite.prepare(`SELECT count(*) as a FROM sqlite_master WHERE type='table' AND name='points'`).get()
|
|
|
|
if(!exists.a)
|
|
generateDB()
|
|
|
|
const Server = express()
|
|
Server.use('/api', api)
|
|
|
|
Server.listen(process.env.PORT, () => console.log(`Server started and listening on port ${process.env.PORT}.`))
|
|
|
|
//ddnssStart()
|