Skip to content

Instantly share code, notes, and snippets.

@N-Hidaya
Created July 20, 2023 14:20
Show Gist options
  • Save N-Hidaya/a5ca9ab874c6052d1d8242c832ca8443 to your computer and use it in GitHub Desktop.
Save N-Hidaya/a5ca9ab874c6052d1d8242c832ca8443 to your computer and use it in GitHub Desktop.
about file
const express = require('express');
const router = express.Router();
router.get(`/`, function (req, res) {
res.status(200).json({msg: `Hi there! Welcome to our API. This is a GET request.`});
});
router.post(`/`,function (req, res) {
res.status(200).json({msg: `Hi there! This is a POST request.`});
})
router.put(`/`, function (req, res) {
res.status(200).json({msg: `Hi there! This is a PUT request.`})
})
router.delete(`/`, function (req, res) {
res.status(200).json({msg: `Hi there! This is a DELETE request`})
})
module.exports = router;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment