-
Notifications
You must be signed in to change notification settings - Fork 144
/
app.js
41 lines (32 loc) · 1007 Bytes
/
app.js
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
30
31
32
33
34
35
36
37
38
39
40
41
/* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
*/
const express = require("express");
const morgan = require("morgan");
const bodyParser = require('body-parser');
const cors = require('cors');
const cookieParser = require('cookie-parser');
const expressValidator = require('express-validator');
require('dotenv').config();
//import routes
const phoneNumberRoutes = require('./routes/phone-number');
const mediaRoutes = require('./routes/media');
//app
const app = express();
//middleware
app.use(morgan('dev'));
app.use(bodyParser.json());
app.use(cookieParser());
app.use(expressValidator());
app.use(cors());
//routes middleware
app.use('/api',phoneNumberRoutes);
app.use('/api',mediaRoutes);
//routes
const port = 8000
app.listen(port,()=> {
console.log(`Server is running on port ${port}`);
});