TempTracker/server.js
seiichiro 8f51247037 Temperature-DB Working
* GET all, PUT and POST working
* JQuery Mobile page to show temperatures
* Send HTML for index
2015-02-08 14:00:44 +01:00

27 lines
616 B
JavaScript

// Main File, configure and start the Server
// Load the modules
var express = require("express");
var bodyParser = require('body-parser');
var tempdb = require("./routes/tempdb.js");
var index = require("./routes/index.js");
global.rootpath = __dirname;
var srv = express();
srv.use(bodyParser());
srv.get("/temp", tempdb.getAll);
srv.get("/temp/:id", tempdb.getTemp);
srv.post("/temp", tempdb.addTemp);
srv.put("/temp/:id", tempdb.updTemp);
srv.get("/", index.index);
srv.get("/inc/:file", index.inc);
srv.get("/inc/images/:file", index.img);
srv.listen(3000);
console.log("Server started on port 3000.");