Created
May 15, 2019 14:40
-
-
Save Nocktiss/59f09ec0dc6b027b5e52c63f0c683805 to your computer and use it in GitHub Desktop.
Node_Js2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const express = require('express'); | |
const connection = require('./conf'); | |
const app = express() | |
const port = 3000 | |
app.get('/api/movie', (req, res) => { | |
connection.query('SELECT * from movie', (err, results) => { | |
if (err) { | |
res.status(500).send('Erreur lors de la récupération des employés'); | |
} else { | |
res.json(results); | |
} | |
}); | |
}); | |
app.get('/api/movie/names', (req, res) => { | |
connection.query('SELECT names from movie', (err, results) => { | |
if (err) { | |
res.status(500).send('Erreur lors de la récupération des employés'); | |
} else { | |
res.json(results); | |
} | |
}); | |
}); | |
app.listen(port) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment