Created
February 21, 2024 17:18
-
-
Save DotAmzi/a3ab63d02f1a15a5f66a818f5a80eeed to your computer and use it in GitHub Desktop.
arquivo node test
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
| const express = require('express'); | |
| const app = express(); | |
| const port = 3000; | |
| app.use(express.json()); | |
| app.get('/', (req, res) => { | |
| console.log('GET request received'); | |
| res.send('Hello GET!'); | |
| }); | |
| app.post('/', (req, res) => { | |
| console.log('POST request received'); | |
| console.log(req.body); | |
| res.send('Hello POST!'); | |
| }); | |
| app.listen(port, () => { | |
| console.log(`Server running at http://localhost:${port}`); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment