Skip to content

Instantly share code, notes, and snippets.

@thawkin3
Created Jan 30, 2021
Embed
What would you like to do?
JSON Server configuration for the Dad Joke Dadabase
const jsonServer = require('json-server')
const server = jsonServer.create()
const router = jsonServer.router('db.json')
const middlewares = jsonServer.defaults()
server.use(middlewares)
server.use(router)
server.listen(process.env.PORT || 3000, () => {
console.log(`🚀 JSON Server is running on port ${process.env.PORT || 3000}`)
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment