filesharing/server.js

30 lines
814 B
JavaScript
Raw Normal View History

2022-08-26 04:34:04 +00:00
const { SERVER_HOST, SERVER_PORT, MONGODB_URL } = require('./config')
2022-08-25 06:34:16 +00:00
const express = require('express')
const mongoose = require('mongoose')
2022-08-26 04:34:04 +00:00
mongoose.connect(MONGODB_URL, (error) => {
if (error) {
console.error(error)
} else {
console.info('mongodb connected successfully')
}
})
2022-08-25 06:34:16 +00:00
const app = express()
2022-08-25 06:43:38 +00:00
app.set('view engine', 'pug')
app.use(express.static('public'))
app.use(express.urlencoded({ extended: true }))
app.use(express.json())
app.get('/', (req, res) => {
res.render('index')
})
app.post('/upload', (req, res) => {
res.sendStatus(201)
2022-08-25 06:34:16 +00:00
})
const server = app.listen(SERVER_PORT, SERVER_HOST, () => {
console.info(`server is running at http://${SERVER_HOST}:${SERVER_PORT}`)
2022-08-25 06:34:16 +00:00
})
/**
* "bcrypt": "^5.0.1",
"md5-file": "^5.0.0",
"multer": "^1.4.5-lts.1",
*/