Skip to content

Commit

Permalink
✨ feat(server): create jobs endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
EvandroCalado committed Feb 19, 2024
1 parent b9f5977 commit 6f4084c
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions server.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,26 @@
import * as dotenv from "dotenv";
import express from "express";
import morgan from "morgan";
import jobRouter from "./routes/jobRouter.js";

const app = express();
dotenv.config();
const app = express();

app.use(express.json());
if (process.env.NODE_ENV === "development") {
app.use(morgan("dev"));
}

app.use(express.json());

// index
app.get("/", (req, res) => {
res.json({ message: "Hello World!" });
res.json({ message: "Wellcome to jobify API!" });
});

app.use("/api/v1/jobs", jobRouter);

app.use((err, req, res, next) => {
console.log(err);
res.status(500).json({ msg: "Something went wrong" });
});

const port = process.env.PORT || 5100;
Expand Down

0 comments on commit 6f4084c

Please sign in to comment.