diff --git a/app.js b/app.js new file mode 100755 index 0000000..d301821 --- /dev/null +++ b/app.js @@ -0,0 +1,10 @@ +const express = require('express'); +const app = express(); + +app.use((req, res, next) => { + res.status(200).json({ + message: "C'est bon!" + }); // pour envoyer une json response 200 +}); + +module.exports = app; \ No newline at end of file diff --git a/server.js b/server.js index 719865b..ed6d5b4 100755 --- a/server.js +++ b/server.js @@ -1 +1,8 @@ -const http = require('http'); \ No newline at end of file +const http = require('http'); +const app = require('./app'); + +const port = process.env.PORT || 3000; + +const server = http.createServer(app); + +server.listen(port); \ No newline at end of file