Created
April 29, 2018 05:50
-
-
Save jlozovei/ce99dd7f242398602cede6ad52e5323b to your computer and use it in GitHub Desktop.
app.js example - node api
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' | |
// 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