Created
January 9, 2020 16:25
-
-
Save Odomhae/4dcceabd8231404ab321862a66aa52b5 to your computer and use it in GitHub Desktop.
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
var express = require('express'); | |
var path = require('path'); | |
var logger = require('morgan'); | |
var indexx = require('./routes/index'); | |
var app = express(); | |
// view engine setup | |
app.set('views', path.join(__dirname, 'views')); | |
app.set('view engine', 'ejs'); | |
console.log('view engine is set as ejs'); | |
// set path for static assets | |
//app.use(express.static(path.join(__dirname, 'public'))); | |
//console.log('122ejs'); | |
// routes | |
app.use('/', indexx); | |
//console.log('1s ejs'); | |
// catch 404 and forward to error handler | |
/*app.use(function(req, res, next) { | |
var err = new Error('Not Found'); | |
err.status = 404; | |
next(err); | |
}); | |
// error handler | |
app.use(function(err, req, res, next) { | |
// render the error page | |
res.status(err.status || 500); | |
res.render('error', {status:err.status, message:err.message}); | |
}); | |
*/ | |
module.exports = app; | |
app.listen(3000,function(){ | |
console.log('example is starteed!'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment