Skip to content

Instantly share code, notes, and snippets.

@thawkin3
Created January 30, 2021 05:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thawkin3/bb384c7c32d3299c4634a7519b8ec852 to your computer and use it in GitHub Desktop.
Save thawkin3/bb384c7c32d3299c4634a7519b8ec852 to your computer and use it in GitHub Desktop.
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