aboutsummaryrefslogtreecommitdiff
path: root/src/server.ts
diff options
context:
space:
mode:
authorRitesh Ghosh <[email protected]>2023-08-02 13:40:23 +0530
committerRitesh Ghosh <[email protected]>2023-08-02 13:40:23 +0530
commite758c74d15a5158003b8fb6d3729c2224503fe68 (patch)
tree181c588dcd4cf3d98cd7d45943f3e514ce030771 /src/server.ts
parentd28def94031cc6d330ff0d42c071bd3118e5b642 (diff)
downloadaniwatch-api-e758c74d15a5158003b8fb6d3729c2224503fe68.tar.xz
aniwatch-api-e758c74d15a5158003b8fb6d3729c2224503fe68.zip
feat: added anime router
Diffstat (limited to 'src/server.ts')
-rw-r--r--src/server.ts19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/server.ts b/src/server.ts
index fe723bc..1b7e8e8 100644
--- a/src/server.ts
+++ b/src/server.ts
@@ -5,10 +5,13 @@ import express, {
ErrorRequestHandler,
Application,
} from "express";
+
import { config } from "dotenv";
import morgan from "morgan";
import createHttpError from "http-errors";
+import animeRouter from "./routes";
+
config();
const app: Application = express();
const PORT: number = Number(process.env.PORT) || 4000;
@@ -16,8 +19,20 @@ const PORT: number = Number(process.env.PORT) || 4000;
app.use(morgan("dev"));
app.get("/", (req: Request, res: Response) => {
- res.json("hi there");
+ res.send(`
+ <body style="font-family: sans-serif; background: #000; color: #FFF;">
+ <h3>Welcome to Zoro.to api ⚔️</h3>
+ <a
+ style="color: #00AEDD;"
+ href="https://github.com/ghoshRitesh12/zoro.to-api#readme"
+ rel="noopener noreferer"
+ >
+ Visit docs for more into
+ </a>
+ </body>
+ `);
});
+app.use("/anime", animeRouter);
app.use((req: Request, res: Response, next: NextFunction) =>
next(createHttpError.NotFound())
@@ -33,5 +48,5 @@ const errorHandler: ErrorRequestHandler = (error, req, res, next) => {
app.use(errorHandler);
app.listen(PORT, () => {
- console.log(`⚔ api @ http://localhost:${PORT}`);
+ console.log(`⚔️ api @ http://localhost:${PORT}`);
});