Created
May 13, 2018 02:38
-
-
Save jlozovei/8f4ed82f15811d1b971ec19d5d4c71f6 to your computer and use it in GitHub Desktop.
node restful api tutorial - app.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'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