Skip to content

Instantly share code, notes, and snippets.

@N-Hidaya
Created July 20, 2023 14:20
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
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