@json-express/core
Version:
A simple json server which serves all json files
15 lines (12 loc) • 749 B
JavaScript
const logJsonRoutes = (jsonRoutes, port) => {
Object.keys(jsonRoutes).forEach(route => {
console.log(`Get ${route}: GET http://localhost:${port}/${route}`)
console.log(`Get one ${route}: GET http://localhost:${port}/${route}/:id`)
console.log(`Search ${route}: POST http://localhost:${port}/${route}`)
console.log(`Create ${route}: POST http://localhost:${port}/${route}`) //:TODO think of how to show request body since it's dynamic, ie, suggested by user
console.log(`Update ${route}: PATCH http://localhost:${port}/${route}/:id`)
console.log(`Delete ${route}: DELETE http://localhost:${port}/${route}/:id`)
console.log()
})
}
export default logJsonRoutes