-
Notifications
You must be signed in to change notification settings - Fork 1
/
app.js
32 lines (21 loc) · 1.12 KB
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
//============================== requirements ==============================//
var express = require('express');
var bodyParser = require('body-parser');
var indexController = require('./controllers/index.js');
var mongoose = require('mongoose')
var googleTranslate = require('google-translate')('AIzaSyB45lmg3rb9SqYMqXoMjKbfI_DQghWvq1Y');
//============================== config ==============================//
var app = express();
app.set('view engine', 'jade');
app.set('views', __dirname + '/views');
app.use(express.static(__dirname + '/public'));
app.use(bodyParser.urlencoded({extended: false}));
//============================== routing ==============================//
app.get('/', indexController.index);
app.get('/translate', indexController.translate)
// take form data here and build controller to send request data via AJAX to server.
// app.post('/get-word', indexController.something)
//============================== server/db ==============================//
var server = app.listen(8152, function() {
console.log('Express server listening on port ' + server.address().port);
});