-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathserver.js
More file actions
31 lines (24 loc) · 914 Bytes
/
Copy pathserver.js
File metadata and controls
31 lines (24 loc) · 914 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
const express = require("express");
const cors = require("cors");
const path = require('path');
const dot=require('dotenv').config({ path: path.join(__dirname,".env") })
const app = express();
app.use(cors())
var ingredient = require(path.join(__dirname, "app/ingredient"));
var step = require(path.join(__dirname, "app/step"));
var category = require(path.join(__dirname, "app/category"));
var allergen= require(path.join(__dirname, "app/allergen"));
var recipe= require(path.join(__dirname, "app/recipe"));
app.use(express.json());
app.use(express.urlencoded({ extended: true }));
app.use('/', step);
app.use('/ingredient', ingredient);
app.use('/step', step);
app.use('/category', category);
app.use('/allergen',allergen);
app.use('/recipe',recipe);
// set port, listen for requests
const PORT = process.env.PORT || 8080;
app.listen(PORT, () => {
console.log(`Server is running on port ${PORT}.`);
});