forked from waste-not/waste-not
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.js
More file actions
18 lines (15 loc) · 717 Bytes
/
server.js
File metadata and controls
18 lines (15 loc) · 717 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
const express = require('express');
const app = express();
const mongoose = require('mongoose');
mongoose.connect(process.env.MONGODB_URI || 'mongodb://localhost/waste_not');
const authRouter = require(__dirname + '/routes/auth_routes');
const inventoryRouter = require(__dirname + '/routes/inventory_routes');
const publicRouter = require(__dirname + '/routes/public_routes');
app.use('/api', authRouter);
app.use('/api', inventoryRouter);
app.use('/api', publicRouter);
app.use(express.static(__dirname + '/dist'));
app.use('/data', express.static(__dirname + '/data'));
const PORT = process.env.PORT || 3000;
module.exports = exports = app
.listen(PORT, () => console.log('Server started on port: ' + PORT));