-
Notifications
You must be signed in to change notification settings - Fork 48
Expand file tree
/
Copy pathserver.min.js
More file actions
1 lines (1 loc) · 1.41 KB
/
server.min.js
File metadata and controls
1 lines (1 loc) · 1.41 KB
1
var express=require("express"),mongoose=require("mongoose"),bodyParser=require("body-parser"),multipart=require("connect-multiparty"),multipartMiddleware=multipart(),app=express(),authenticationController=require("./server/controllers/authentication-controller"),profileController=require("./server/controllers/profile-controller"),wasteController=require("./server/controllers/waste-controller"),usersController=require("./server/controllers/users-controller");mongoose.connect("mongodb://localhost:27017/time-waste"),app.use(bodyParser.json()),app.use(multipartMiddleware),app.use("/app",express["static"](__dirname+"/app")),app.use("/node_modules",express["static"](__dirname+"/node_modules")),app.use("/uploads",express["static"](__dirname+"/uploads")),app.get("/",function(e,o){o.sendfile("index.html")}),app.post("/api/user/signup",authenticationController.signup),app.post("/api/user/login",authenticationController.login),app.post("/api/profile/editPhoto",multipartMiddleware,profileController.updatePhoto),app.post("/api/profile/updateUsername",profileController.updateUsername),app.post("/api/profile/updateBio",profileController.updateBio),app.post("/api/waste/post",wasteController.postWaste),app.post("/api/waste/get",wasteController.getWastes),app.get("/api/users/get",usersController.getUsers),app.post("/api/users/follow",usersController.followUser),app.listen("3000",function(){console.log("Listening for Local Host 3000")});