Advertisement
Guest User

Untitled

a guest
Aug 19th, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const express = require('express');
  2. const path = require('path');
  3. const bodyParser = require('body-parser');
  4. const cookieParser = require('cookie-parser');
  5. const flash = require('connect-flash');
  6. const routes = require('./routes/index');
  7.  
  8. const app = express();        //deklaracja nowej instancji aplikacji
  9.  
  10. app.set('views', path.join(__dirname, 'views'));      //deklaracja ścieżki katalogu widoków
  11. app.set('view engine', 'pug');        //deklaracja silnika szablonu widoków
  12. app.set(express.static(path.join(__dirname, 'public')));      //deklaracja ścieżki katalogu plików statycznych
  13.  
  14. app.use(bodyParser.json());
  15. app.use(bodyParser.urlencoded({ extended: true}));        //konfiguracja ustawień body-parsera
  16. app.use(cookieParser());
  17.  
  18. app.use(flash());        //konfiguracja ustawień modułu connect-flash
  19.  
  20. app.use('/', routes);      //kofniguracja routera do obsługi zapytań rozpoczynających się od "/"
  21.  
  22. module.exports = app;        //przypisanie instancji aplikacji do obiektu
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement