Last active
September 11, 2020 23:07
-
-
Save tgmarinho/3a38d50190da5f36c8f13b1005be9369 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require("dotenv").config(); | |
const express = require("express"); | |
const morgan = require("morgan"); | |
const mongoose = require("mongoose"); | |
const path = require("path"); | |
const cors = require("cors"); | |
const app = express(); | |
/** | |
* Database setup | |
*/ | |
mongoose.connect( | |
process.env.MONGO_URL, | |
{ | |
useNewUrlParser: true | |
} | |
); | |
app.use(cors()); | |
app.use(express.json()); | |
app.use(express.urlencoded({ extended: true })); | |
app.use(morgan("dev")); | |
app.use( | |
"/files", | |
express.static(path.resolve(__dirname, "..", "tmp", "uploads")) | |
); | |
app.use(require("./routes")); | |
app.listen(3000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment