Skip to content

Instantly share code, notes, and snippets.

@jlozovei
Created April 29, 2018 05:50
Show Gist options
  • Save jlozovei/ce99dd7f242398602cede6ad52e5323b to your computer and use it in GitHub Desktop.
Save jlozovei/ce99dd7f242398602cede6ad52e5323b to your computer and use it in GitHub Desktop.
app.js example - node api
'use strict'
// importing packages
const express = require('express')
const bodyParser = require ('body-parser')
const app = express()
const cors = require('cors')
// applying our parsers
app.use(bodyParser.urlencoded({ extended: true }))
app.use(bodyParser.json())
// setting up cors
app.use(cors())
// setting up the port that our app will be served
app.set('port', (process.env.PORT || 3001))
// setting up our routing schema
app.use('/', require('./routes'))
// exporting app
module.exports = app
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment