Skip to content

Commit

Permalink
added index.js file
Browse files Browse the repository at this point in the history
  • Loading branch information
21stPhenom committed Oct 3, 2023
1 parent f7ebaf4 commit bdde0d6
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
const express = require("express");
const mongoose = require("mongoose");
require("dotenv").config();

const app = express();
const authRoute = require("./routes/auth");
const shopItemsRoute = require("./routes/shopItems");

const connect = mongoose.connect(process.env.mongoDB_URL);

connect.then(() => {
console.log("Connected sucessfully to my database");
}).catch((error) => {
console.log("Could not connect to the database, reason =", error);
});

app.use(express.json());
app.use(express.urlencoded({extended: false}));

app.use('/v1/shop-items', shopItemsRoute);
app.use('/v1/auth', authRoute);

app.listen(4000, () => {
console.log("Listening on port 4000...");
});

0 comments on commit bdde0d6

Please sign in to comment.