Created
April 29, 2018 06:17
-
-
Save jlozovei/4c6df6e2787552dd9e8de3842cee9acd to your computer and use it in GitHub Desktop.
server routing with Express
This file contains 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
'use strict' | |
const express = require('express') | |
const router = express.Router() | |
// @GET at http://localhost:XXXX/ | |
router.get('/', (request, response) => { | |
response.send({ status: 'OK', message: 'Your request was successfully received' }) | |
}) | |
// @POST at http://localhost:XXXX/ | |
router.post('/', (request, response) => { | |
response.send({ status: 'OK', message: 'Your request was successfully received' }) | |
}) | |
// @PUT at http://localhost:XXXX/ | |
router.put('/', (request, response) => { | |
response.send({ status: 'OK', message: 'Your request was successfully received' }) | |
}) | |
// @DELETE at http://localhost:XXXX/ | |
router.delete('/', (request, response) => { | |
response.send({ status: 'OK', message: 'Your request was successfully received' }) | |
}) | |
module.exports = router |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment