Created
May 12, 2020 22:25
-
-
Save ShawonAshraf/a6d9d2e9b563478b95d6c7ff7aed1a14 to your computer and use it in GitHub Desktop.
node-express-medium
This file contains hidden or 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
| import express from 'express'; | |
| import morgan from 'morgan'; | |
| import bodyParser from 'body-parser'; | |
| const app = express(); | |
| app.use(morgan('combined')); | |
| app.use(bodyParser.json()); | |
| app.get('/', (req, res) => { | |
| res.send({ | |
| message: 'hey there docker!', | |
| status: '200', | |
| }); | |
| }); | |
| app.get('/status', (req, res) => { | |
| res.send({ | |
| status: '200', | |
| }); | |
| }); | |
| const port = process.env.PORT || 3000; | |
| app.listen(port, () => { | |
| console.log(`Server running at * ${port}`); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment