mirror of
https://github.com/docker/awesome-compose.git
synced 2025-04-25 18:28:07 +02:00
Sample React-Express-MongoDB (#59)
Signed-off-by: Afzal <sah.afzal@gmail.com>
This commit is contained in:
parent
3599a2e685
commit
2f750eb4f7
43 changed files with 18779 additions and 0 deletions
35
react-express-mongodb/server/server.js
vendored
Normal file
35
react-express-mongodb/server/server.js
vendored
Normal file
|
@ -0,0 +1,35 @@
|
|||
/**
|
||||
* Created by Syed Afzal
|
||||
*/
|
||||
require('./config/config');
|
||||
|
||||
const express = require('express');
|
||||
const path = require('path');
|
||||
const cookieParser = require('cookie-parser');
|
||||
const bodyParser = require('body-parser');
|
||||
const cors = require('cors');
|
||||
const db = require('./db');
|
||||
|
||||
|
||||
|
||||
const app = express();
|
||||
|
||||
//connection from db here
|
||||
db.connect(app);
|
||||
|
||||
app.use(cors());
|
||||
app.use(bodyParser.json());
|
||||
app.use(bodyParser.urlencoded({ extended: false }));
|
||||
app.use(cookieParser());
|
||||
app.use(express.static(path.join(__dirname, 'public')));
|
||||
|
||||
// adding routes
|
||||
require('./routes')(app);
|
||||
|
||||
app.on('ready', () => {
|
||||
app.listen(3000, () => {
|
||||
console.log("Server is up on port", 3000)
|
||||
});
|
||||
})
|
||||
|
||||
module.exports = app;
|
Loading…
Add table
Add a link
Reference in a new issue