|
@@ -5,19 +5,21 @@ import logger from "morgan";
|
|
|
import express from "express";
|
|
import express from "express";
|
|
|
|
|
|
|
|
import rootRouter from "./routes/root";
|
|
import rootRouter from "./routes/root";
|
|
|
|
|
+import recipeRouter from "./recipes/routes";
|
|
|
|
|
|
|
|
class App {
|
|
class App {
|
|
|
public express: express.Application;
|
|
public express: express.Application;
|
|
|
|
|
|
|
|
constructor() {
|
|
constructor() {
|
|
|
this.express = express();
|
|
this.express = express();
|
|
|
- this.routes();
|
|
|
|
|
this.middleware();
|
|
this.middleware();
|
|
|
|
|
+ this.routes();
|
|
|
this.launchConf();
|
|
this.launchConf();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private routes(): void {
|
|
private routes(): void {
|
|
|
this.express.use("/", rootRouter);
|
|
this.express.use("/", rootRouter);
|
|
|
|
|
+ this.express.use("/recipes", recipeRouter);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private middleware(): void {
|
|
private middleware(): void {
|
|
@@ -35,7 +37,7 @@ class App {
|
|
|
console.log('port', port);
|
|
console.log('port', port);
|
|
|
this.express.listen(port, () => {
|
|
this.express.listen(port, () => {
|
|
|
console.log(
|
|
console.log(
|
|
|
- ("App is running at http://localhost:%d in %s mode"),
|
|
|
|
|
|
|
+ ("App is runnnning at http://localhost:%d in %s mode"),
|
|
|
port,
|
|
port,
|
|
|
this.express.get("env")
|
|
this.express.get("env")
|
|
|
);
|
|
);
|