diff options
author | Mateja <mail@matejamaric.com> | 2021-05-09 14:41:41 +0200 |
---|---|---|
committer | Mateja <mail@matejamaric.com> | 2021-05-09 14:41:41 +0200 |
commit | 5ed4787e33e258cc9afa7e9d2886a0b590d69715 (patch) | |
tree | aaad7a8e13ea08b7d548ede3a799d848efb1c730 /index.js | |
parent | 766b60adf81664c59bda39ebc5350af67e325f4e (diff) | |
download | node-playground-5ed4787e33e258cc9afa7e9d2886a0b590d69715.tar.gz node-playground-5ed4787e33e258cc9afa7e9d2886a0b590d69715.zip |
Returning validation errors and old values to `post` form.
Made custom middleware for that purpose.
Diffstat (limited to 'index.js')
-rw-r--r-- | index.js | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -7,6 +7,8 @@ const flash = require('connect-flash'); const passport = require('passport'); require('dotenv').config(); +const oldForm = require('./utils/middleware/oldForm'); + const webRoutes = require('./routes/web'); const app = express(); @@ -42,6 +44,8 @@ require('./config/passport'); app.use(passport.initialize()); app.use(passport.session()); +app.use(oldForm); + app.use('/', webRoutes); app.listen(process.env.PORT, () => console.log(`Server started on port ${process.env.PORT}.`)); |