You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
673 B
32 lines
673 B
// dependencies
|
|
var express = require('express'),
|
|
bodyParser = require('body-parser'),
|
|
mongoose = require('mongoose');
|
|
|
|
var app = express();
|
|
var port = process.env.PORT || 3000;
|
|
|
|
|
|
// db connect
|
|
mongoose.connect('mongodb://localhost/no_name');
|
|
|
|
|
|
// middleware
|
|
app.use(express.static('public'));
|
|
|
|
app.use(bodyParser.urlencoded({ extended: false }));
|
|
app.use(bodyParser.json());
|
|
|
|
app.get('/', function(req, res) {
|
|
res.redirect('/hehe');
|
|
});
|
|
|
|
|
|
// listener
|
|
app.listen(port, function() {
|
|
console.log('=======================');
|
|
console.log('No Name App');
|
|
console.log('Running on port ' + port);
|
|
console.log('=======================');
|
|
});
|