1
restaurant-search/server/server.js
2014-07-28 16:48:24 +09:00

28 lines
508 B
JavaScript
Executable File

#!/usr/bin/env node
'use strict';
var express = require('express');
var search = require('./db/search.js');
function main() {
var app = express();
app.use('/keywords', function(req, res) {
console.log('Requesting keywords');
res.json(search.getKeywords());
});
app.use('/search', function(req, res) {
console.log('Requesting search');
res.json(search.execQuery(req.query));
});
app.listen(3000);
}
if (require.main === module) {
main();
}