Last active
October 20, 2019 16:51
-
-
Save AlissonAp/fdabc9adda8ec73a9f1dceaccae62bdf to your computer and use it in GitHub Desktop.
Api pagamentos
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
const express = require('express'); | |
const bodyParser = require('body-parser'); | |
const cors = require('cors'); | |
const engines = require('consolidate'); | |
const path = require('path'); | |
//Routes | |
const paymentsRoute = require('./src/routes/paymentsRoute'); | |
//Load environment | |
require('./src/config/getEnv')() | |
const app = express(); | |
app.use(cors()); | |
app.use(bodyParser.urlencoded({extended : false})); | |
app.use(bodyParser.json()); | |
//For render views | |
app.engine("ejs", engines.ejs); | |
app.set('views', path.join(__dirname, './src/views')); | |
app.set("view engine", "ejs"); | |
//Payments route | |
app.use('/payments',paymentsRoute); | |
app.listen(process.env.API_PORT, function(err){ | |
if(err) console.error(err); | |
console.log(`API INICIADA NA PORTA ${process.env.API_PORT}`) | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment