Revert server configuration in its own file
This commit is contained in:
parent
0f11632263
commit
dc30471806
22
api/server.js
Normal file
22
api/server.js
Normal file
@ -0,0 +1,22 @@
|
||||
const express = require('express');
|
||||
const cors = require('cors');
|
||||
const helmet = require('helmet');
|
||||
require('dotenv').config();
|
||||
|
||||
const accountsRoute = require('../api/routes/accountRoute');
|
||||
|
||||
const server = express();
|
||||
|
||||
server.use(express.json());
|
||||
server.use(cors());
|
||||
server.use(helmet());
|
||||
|
||||
server.use('/api/accounts', accountsRoute);
|
||||
|
||||
server.get('/', (req, res) =>
|
||||
res
|
||||
.status(200)
|
||||
.send('<h2>Welcome to Meeting Planner Backend API service.</h2>'),
|
||||
);
|
||||
|
||||
module.exports = server;
|
21
index.js
21
index.js
@ -1,23 +1,4 @@
|
||||
const express = require('express');
|
||||
const cors = require('cors');
|
||||
const helmet = require('helmet');
|
||||
require('dotenv').config();
|
||||
|
||||
const accountsRoute = require('./api/routes/accountRoute');
|
||||
|
||||
const server = express();
|
||||
|
||||
server.use(express.json());
|
||||
server.use(cors());
|
||||
server.use(helmet());
|
||||
|
||||
server.use('/api/accounts', accountsRoute);
|
||||
|
||||
server.get('/', (req, res) =>
|
||||
res
|
||||
.status(200)
|
||||
.send('<h2>Welcome to Meeting Planner Backend API service.</h2>'),
|
||||
);
|
||||
const server = require('./api/server.js');
|
||||
|
||||
const PORT = process.env.PORT || 3001;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user