You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
greenvironment-server/src/routes/home.ts

56 lines
1.1 KiB
TypeScript

import {Router} from "express";
import {Server} from "socket.io";
import Route from "../lib/Route";
/**
* Class for the home route.
*/
class HomeRoute extends Route {
/**
* Constructor, creates new router.
*/
constructor() {
super();
this.router = Router();
this.configure();
}
/**
* Asynchronous init for socket.io.
* @param io - the io instance
*/
public async init(io: Server) {
this.io = io;
}
/**
* Destroys the instance by dereferencing the router and resolver.
*/
public async destroy(): Promise<void> {
this.router = null;
this.resolver = null;
}
/**
* Returns the resolvers for the graphql api.
* @param req - the request object
* @param res - the response object
*/
public async resolver(req: any, res: any): Promise<object> {
return {
// TODO: Define grapql resolvers
};
}
/**
* Configures the route.
*/
private configure() {
this.router.get("/", (req, res) => {
res.render("home");
});
}
}
export default HomeRoute;