forked from Qasem-moh/Jam3ey
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.js
More file actions
32 lines (25 loc) · 778 Bytes
/
server.js
File metadata and controls
32 lines (25 loc) · 778 Bytes
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
29
'use strict';
const express = require('express');
const app = express();
app.use(express.json());
const cors = require('cors');
app.use(cors());
const studentRout = require('./routes/student.rout');
const supervisorRout = require('./routes/supervisor.rout');
const errorHandler = require('./error-handlers/500');
const notFound = require('./error-handlers/404');
const booksRout = require('./routes/books.rout');
app.get('/', (req, res) => { res.send("hello world");});
app.use(express.urlencoded({ extended: true }));
app.use(studentRout);
app.use(supervisorRout);
app.use(booksRout);
app.use(errorHandler);
app.use(notFound);
const start=(port)=>{
app.listen(port,()=>console.log(`listining to port : ${port}` ))
}
module.exports={
start:start,
app:app
};