Making everything look pretty

This commit is contained in:
2019-10-01 20:39:21 -04:00
parent 07e9271132
commit c218081759
9 changed files with 274 additions and 260 deletions

View File

@@ -1,48 +1,47 @@
/* eslint-disable promise/always-return */
const functions = require('firebase-functions');
const app = require('express')();
const fbAuth = require('./util/fbAuth');
const {db} = require('./util/admin');
const cors = require('cors');
const app = require("express")();
const cors = require("cors");
const { db } = require("./util/admin");
const fbAuth = require("./util/fbAuth");
const functions = require("firebase-functions");
app.use(cors());
/*------------------------------------------------------------------*
* handlers/users.js *
*------------------------------------------------------------------*/
* handlers/users.js *
*------------------------------------------------------------------*/
const {
getUserDetails,
getProfileInfo,
login,
signup,
updateProfileInfo,
} = require('./handlers/users');
getUserDetails,
getProfileInfo,
login,
signup,
updateProfileInfo
} = require("./handlers/users");
app.post('/signup', signup);
// Adds a user to the database and registers them in firebase with
// an email and password pair
// Returns a token for the new user
app.post("/signup", signup);
app.post('/login', login);
// Returns a token for the user that matches the provided username
// and password
app.post("/login", login);
app.get('/getUser/:handle', getUserDetails);
app.get("/getUser/:handle", getUserDetails);
// Returns all profile data of the currently logged in user
app.get('/getProfileInfo', fbAuth, getProfileInfo);
app.get("/getProfileInfo", fbAuth, getProfileInfo);
// Updates the currently logged in user's profile information
app.post('/updateProfileInfo', fbAuth, updateProfileInfo);
app.post("/updateProfileInfo", fbAuth, updateProfileInfo);
/*------------------------------------------------------------------*
* handlers/post.js *
*------------------------------------------------------------------*/
const {
getallPostsforUser,
putPost,
} = require('./handlers/post');
const { getallPostsforUser, putPost } = require("./handlers/post");
app.get('/getallPostsforUser', getallPostsforUser);
app.get("/getallPostsforUser", getallPostsforUser);
// Adds one post to the database
app.post('/putPost', fbAuth, putPost);
app.post("/putPost", fbAuth, putPost);
exports.api = functions.https.onRequest(app);
exports.api = functions.https.onRequest(app);