Ability to post in Forum
This commit is contained in:
@@ -7,10 +7,10 @@ const chalk = require('chalk');
|
||||
const moment = require('moment');
|
||||
const path = require('path');
|
||||
|
||||
import { initWebSocket } from './ws.js'
|
||||
import "./util.js"
|
||||
import Socket from './ws/ws.js'
|
||||
import Database from "./db/db.js"
|
||||
import AuthHandler from './auth.js';
|
||||
import handlers from "./handlers.js";
|
||||
|
||||
class Server {
|
||||
db;
|
||||
@@ -21,6 +21,7 @@ class Server {
|
||||
registerRoutes(router) {
|
||||
// router.post('/api/location', handlers.updateLocation)
|
||||
router.post('/login', this.auth.login)
|
||||
router.get('/profile', this.auth.getProfile)
|
||||
router.get('/signout', this.auth.logout)
|
||||
router.get('/signup', this.verifyToken, this.get)
|
||||
router.post('/signup', this.verifyToken, this.newUserSubmission)
|
||||
@@ -171,8 +172,13 @@ class Server {
|
||||
this.registerRoutes(router)
|
||||
app.use('/', router);
|
||||
|
||||
setInterval(() => {
|
||||
console.log("saving db")
|
||||
global.db.saveData()
|
||||
}, 5000)
|
||||
|
||||
const server = http.createServer(app);
|
||||
initWebSocket(server);
|
||||
global.Socket = new Socket(server);
|
||||
const PORT = 3003;
|
||||
server.listen(PORT, () => {
|
||||
console.logclean("\n")
|
||||
@@ -219,11 +225,4 @@ console.logclean = function (...args) {
|
||||
// _log.call(console, `[${location}]`, ...args);
|
||||
// };
|
||||
|
||||
global.ServerError = class extends Error {
|
||||
constructor(status, msg) {
|
||||
super(msg);
|
||||
this.status = status;
|
||||
}
|
||||
}
|
||||
|
||||
const server = new Server()
|
||||
Reference in New Issue
Block a user