123456789101112131415161718192021222324252627 |
- import express from 'express';
- import cors from 'cors';
- import bodyParser from 'body-parser';
- import router from './routes';
- import mongoose from 'mongoose';
- import httpContext from 'express-http-context';
- const app = express();
- mongoose.connect('mongodb://localhost/knowledgeBaseDB', { useNewUrlParser: true });
- mongoose.Promise = global.Promise;
- app.use(cors());
- app.use(bodyParser.json());
- app.use(bodyParser.urlencoded({ extended: false }));
- app.use(router);
- const PORT = 5000;
- app.listen(PORT, () => {
- console.log(`server running on port ${PORT}`);
- });
|