-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
51 lines (36 loc) · 1.19 KB
/
index.js
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/*
var express = require('express');
var mongoose = require('mongoose');
var bodyParser = require('body-parser');
const cors = require('cors');
var path = require('path');
const cookieParser = require('cookie-parser')
require('dotenv').config()
//const route = require('./routes');
const routes = require('./routes/index')
*/
//import { certificateModel } from "../SHARED.CODE/index.mjs";
//import { certificateModel } from "shared.code/index.mjs";
//import pkg from 'shared.code';
//const { certificateModel } = pkg;
import express from 'express';
import cors from 'cors';
import path from 'path';
import cookieParser from 'cookie-parser';
import bodyParser from 'body-parser';
import dotenv from 'dotenv';
import fileUpload from 'express-fileupload';
import routes from './routes/index.js';
dotenv.config();
var app = express();
const port = 3030;
app.use(express.static('public'));
app.use(cors())
app.use(fileUpload());
app.use(bodyParser.json());
app.use(cookieParser())
//app.use('/api',route)
routes(app);
let __dirname = path.resolve(path.dirname(''));
app.use(express.static(path.join(__dirname, 'public')));
app.listen(port, () => { console.log('App is up and running at port:' + port) })