Basic router in TypeScript (Sample code)

PHOTO EMBED

Mon Apr 25 2022 15:34:04 GMT+0000 (Coordinated Universal Time)

Saved by @soyreynald ##nodejs ##request ##typescript ##routing

import { Router } from 'express'
const router = Router()

router.route('/')
    .get((req, res) => {
        res.json('Welcome to my API')
    })


export default router
content_copyCOPY

It just retturns a Welcome to my API, it has to be executed after being imported strategically.

https://www.youtube.com/watch?v=4clEduk6OQM