-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathserver.js
More file actions
21 lines (18 loc) · 863 Bytes
/
server.js
File metadata and controls
21 lines (18 loc) · 863 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
const express = require("express");
// import path from 'path';
const path=require("path");
const routes = require("./routes");
const server = express();
const bodyParser = require('body-parser');
const cors = require('cors');
server.use(cors());
server.use(bodyParser.json()) // for parsing application/json
server.use(bodyParser.urlencoded({ extended: true }))
// server.use(express.static(__dirname + '/public'));
// server.get('*', (req,res) => res.sendFile(path.join(__dirname+'/public/index.html')));
// server.get("/", (req,res) => res.sendFile(path.join(__dirname+'/public/index.html')));
// server.get('*', (req,res) => res.sendFile(path.join(__dirname+'/public/index.html'))).listen(5000,() => console.log('Server on port 5000'))
server.use(express.json());
server.use(express.static("public"));
server.use(routes);
module.exports = server;