Skip to content

Commit

Permalink
Merge pull request #4 from Project-Tribe-App/development
Browse files Browse the repository at this point in the history
Stable Build v1.1.0
  • Loading branch information
sharshv2012 authored Nov 10, 2024
2 parents 76ec265 + 6571788 commit fbf4f08
Show file tree
Hide file tree
Showing 19 changed files with 975 additions and 8 deletions.
207 changes: 202 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"name": "tribe-serverside",
"version": "1.0.0",
"version": "1.1.0",
"description": "",
"main": "app.js",
"scripts": {
"test": "jest",
"start": "nodemon src/local.js"
},
"keywords": [],
"author": "Arya, Tushar, Harsh, Lakshya",
"author": "Tushar, Arya, Harsh, Lakshya, Liza",
"license": "ISC",
"devDependencies": {
"@vendia/serverless-express": "^4.12.6",
Expand All @@ -25,6 +25,7 @@
"express": "^4.21.0",
"graphql": "^16.9.0",
"jsonwebtoken": "^9.0.2",
"mongoose": "^8.7.0"
"mongoose": "^8.7.0",
"socket.io": "^4.8.1"
}
}
37 changes: 37 additions & 0 deletions src/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
const express = require('express');
const { handleRouteErrors } = require('./error');
const connectToMongo = require('./config/database');
const userRouter = require('./routes/user-route')
const authRouter = require('./routes/auth-routes');
const chatRouter = require("./socket/chat-route");

const app = express();

const port = process.env.PORT || 3000;

//for connecting to users database
connectToMongo()

// middleware
app.use(express.json());
app.use(express.urlencoded({ extended: true }))

// routes
app.use('/', [userRouter, authRouter, chatRouter]);

// Global Error Handler
app.use((err, req, res, next) => {
console.error('GlobalError', err);
handleRouteErrors(err, req, res, next);
});

// Not Found Handler
app.use('*', (_req, res) => {
res.status(404).json({
status: 'Not Found',
message: "This route doesn't exists!",
});
});


module.exports = app;
Loading

0 comments on commit fbf4f08

Please sign in to comment.