forked from yemiwebby/node-planetscale-crm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.ts
28 lines (20 loc) · 780 Bytes
/
app.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import express from "express";
import * as dotenv from "dotenv";
import { create, destroy, index, store } from "./controllers/client";
import bodyParser from "body-parser";
import { clientInputCheck } from "./utility/validator";
dotenv.config();
const app = express();
app.use(bodyParser.urlencoded({ extended: true }));
app.set("views", "./views");
app.set("view engine", "pug");
app.get("/", (req, res) => {
res.render("index", { title: "Hey", message: "Hello, World ✌️" });
});
app.get("/clients", index);
app.get("/client/create", create);
app.post("/client", clientInputCheck(), store);
app.post("/client/delete/:id", destroy);
// @ts-ignore
const { APP_PORT: port } = process.env || 8000;
app.listen(port, () => console.log(`Server started on port ${port}`));