Advertisement
Guest User

Untitled

a guest
Feb 23rd, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var http = require('http');
  2. var express = require('express');
  3. var app = express();
  4.  
  5. const port = 8000;
  6.  
  7. app.use(express.static('public'));
  8.  
  9. app.get('/', function(request, response) {
  10.     console.log("asd");
  11.     response.sendFile(__dirname + '/index.html');
  12. });
  13.  
  14. app.get('/controller', function(request, response) {
  15.     console.log(__dirname + '/controller.html');
  16.     response.sendFile(__dirname + '/public/controller.html');
  17. });
  18.  
  19. /*server = http.createServer(function(request, response){
  20.   response.writeHead(200, {'Content-type':'text/html'});
  21.   response.write('Hello Node JS Server Response');
  22.   response.end();
  23.  
  24. });*/
  25.  
  26. app.listen(port);
  27. console.log(`Server running at http://localhost:${port}/`);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement