Skip to content

Instantly share code, notes, and snippets.

@jlozovei
Created May 13, 2018 02:38
Show Gist options
  • Save jlozovei/8f4ed82f15811d1b971ec19d5d4c71f6 to your computer and use it in GitHub Desktop.
Save jlozovei/8f4ed82f15811d1b971ec19d5d4c71f6 to your computer and use it in GitHub Desktop.
node restful api tutorial - app.js
'use strict'
// requiring packages
const express = require('express')
const bodyParser = require('body-parser')
const cors = require('cors')
const app = express()
// applying parsers
app.use(bodyParser.urlencoded({ extended: true }))
app.use(bodyParser.json())
// applying cors
app.use(cors())
// setting up default app port
app.set('port', (process.env.PORT || 3001))
// setting up default app routes
app.use('/', require('./routes'))
// exporting app module
module.exports = app
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment