You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
587 B
JavaScript
26 lines
587 B
JavaScript
3 years ago
|
/**
|
||
|
* Install mogodb locally
|
||
|
* https://docs.mongodb.com/manual/tutorial/install-mongodb-on-os-x/
|
||
|
*/
|
||
|
|
||
|
const express = require('express');
|
||
|
const app = express();
|
||
|
const connectDB = require('./config/database');
|
||
|
require('dotenv').config();
|
||
|
|
||
|
connectDB();
|
||
|
|
||
|
// Body Parser
|
||
|
app.use(express.urlencoded({ extended: true }));
|
||
|
app.use(express.json());
|
||
|
app.use(express.static(__dirname + '/'));
|
||
|
|
||
|
app.use('/', require('./routes/index'));
|
||
|
app.use('/api', require('./routes/urls'));
|
||
|
|
||
|
// Server Setup
|
||
|
const PORT = 8080;
|
||
|
app.listen(PORT, () => {
|
||
|
console.log(`Server is running at PORT ${PORT}`);
|
||
|
});
|