forked from zhangchen2397/onlineAPI
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
25 lines (17 loc) · 605 Bytes
/
app.js
File metadata and controls
25 lines (17 loc) · 605 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
var express = require( 'express' ),
path = require( 'path' ),
fs = require( 'fs' ),
mongoose = require( 'mongoose' );
var port = process.env.PORT || 1337,
dbUrl = 'mongodb://localhost/api',
app = express();
mongoose.connect( dbUrl );
require( './app/models/category' );
require( './app/models/api' );
app.set( 'views', './app/views' );
app.set( 'view engine', 'ejs' );
app.use( express.bodyParser() );
app.use( express.static( path.join( __dirname, 'static') ) );
require( './app/routes/routes' )( app );
app.listen( port );
console.log( 'onlineAPI started on port ' + port );