Advertisement
Guest User

this is server /node js

a guest
Dec 8th, 2016
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. var express = require('express');
  2. var bodyParser = require('body-parser');
  3. var app = express();
  4. var fs = require('fs');
  5.  
  6. var mysql = require('mysql');
  7.  
  8. var connection = mysql.createConnection({
  9. host: 'localhost',
  10. user: 'root',
  11. password: 'root',
  12. database: 'NotFB'
  13. });
  14.  
  15.  
  16.  
  17. connection.connect(function(err){
  18. if(err) throw err;
  19. console.log('you are now connected... ');
  20.  
  21. })
  22. ;
  23. app.use(bodyParser.json());
  24. app.use(bodyParser.urlencoded({
  25. extended: true
  26. }));
  27.  
  28. app.use(express.static(__dirname + '/public'));
  29.  
  30.  
  31. app.listen(10001, "0.0.0.0",function() {
  32. //var host = server.address();
  33. console.log('server listening on port ' + 10001);
  34. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement