SHARE
TWEET

server.js

a guest Jul 17th, 2019 66 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Import express
  2. let express = require('express');
  3. // Import Body parser
  4. let bodyParser = require('body-parser');
  5. // Import Mongoose
  6. let mongoose = require('mongoose');
  7. let cors = require('cors')
  8. // Initialize the app
  9. let app = express();
  10.  
  11. // Import routes
  12. let apiRoutes = require("./server/routes/events.js");
  13.  
  14.  
  15. // Configure bodyparser to handle post requests
  16.  
  17. mongoose.connect('mongodb://admin:jarkoM@202.46.4.52:27017/stevia?authSource=admin', {
  18.     useNewUrlParser: true
  19. });
  20.  
  21. var port = process.env.PORT || 9090;
  22.  
  23. app.use(bodyParser.json());
  24. app.use(bodyParser.urlencoded({ extended: true }));
  25. app.use(apiRoutes);
  26. app.listen(port, function () {
  27.     console.log("Running backend TA ainun server on port " + port);
  28. });
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top