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.

26 lines
755 B

10 years ago
10 years ago
var app = require('express')();
10 years ago
/** ----------------------- middleware ----------------------- **/
10 years ago
app.use( require('./middleware/headers') );
app.use( require('./middleware/cors') );
app.use( require('./middleware/jsonp') );
/** ----------------------- routes ----------------------- **/
10 years ago
// api root
app.get( '/', require('./controller/index') );
// suggest API
app.get( '/suggest', require('./sanitiser/sanitise'), require('./controller/suggest') );
// search API
app.get( '/search', require('./sanitiser/sanitise'), require('./controller/search') );
10 years ago
10 years ago
/** ----------------------- error middleware ----------------------- **/
app.use( require('./middleware/404') );
app.use( require('./middleware/500') );
10 years ago
app.listen( process.env.PORT || 3100 );