Skip to content

Instantly share code, notes, and snippets.

@kianaditya
Created June 15, 2020 09:56
Show Gist options
  • Save kianaditya/d35c0752d1dafce30cbb5b6815a9f46f to your computer and use it in GitHub Desktop.
Save kianaditya/d35c0752d1dafce30cbb5b6815a9f46f to your computer and use it in GitHub Desktop.
require('dotenv').config()
const express = require('express')
const logger = require('morgan')
const app = express()
const PORT = process.env.PORT
app.use(logger('dev'))
app.use(express.json()) //http://expressjs.com/en/api.html#express.json
app.use(express.urlencoded({ extended: false })) //http://expressjs.com/en/5x/api.html#express.urlencoded
const postRouter = require('./routes/posts')
app.use('/posts', postRouter)
app.listen(PORT, () => {
console.info(`App listening on port ${PORT}`)
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment