seiichiro
8f51247037
* GET all, PUT and POST working * JQuery Mobile page to show temperatures * Send HTML for index
27 lines
616 B
JavaScript
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.");
|