Skip to content
This repository has been archived by the owner on Jan 8, 2019. It is now read-only.

Commit

Permalink
examples:mysql-server: use mysql for list of movies
Browse files Browse the repository at this point in the history
  • Loading branch information
wooorm committed Feb 28, 2018
1 parent 390c717 commit 88e38b5
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions examples/mysql-server/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,16 @@ express()
.use(notFound)
.listen(8000)

function movies(req, res) {
res.render('list.ejs', {data: data})
function movies(req, res, next) {
connection.query('SELECT * FROM movies', done)

function done(err, data) {
if (err) {
next(err)
} else {
res.render('list.ejs', {data: data})
}
}
}

function movie(req, res, next) {
Expand Down

0 comments on commit 88e38b5

Please sign in to comment.