1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- const express = require('express');
- const bodyParser = require('body-parser');
- const routes = require('./routes/route');
- const https=require("http");
- //const routes = require('../DVR-BACKEND/routes/route');
- const fs = require('fs');
- const app = express();
- const cors= require('cors');
- const port = process.env.PORT || 9000;
- app.use(bodyParser.urlencoded({ extended: false }));
- app.use(express.json());
- app.use(express.urlencoded({
- extended: true
- }));
- // const options = {
- // key: fs.readFileSync('./certificate/private.key'),
- // cert: fs.readFileSync('./certificate/certificate.crt')
- // };
- app.use(cors())
- app.use('/', routes);
- app.all('/*', function (req, res, next) {
- res.header("Access-Control-Allow-Origin", "*");
- res.header("Access-Control-Allow-Methods", "*");
- res.header("Access-Control-Allow-Headers", "*");
- next();
- });
- // https.createServer(options, app).listen(port, () => {
- // console.log(` listening port at https://localhost:${port}`)
- // });
- app.listen(port,()=>{
- console.log("listening port at http://localhost:9000");
- })
|