Skip to content

Commit fab4e33

Browse files
LloydVincentnicolasgarnier
authored andcommitted
Remove unneeded "api" segment in path (firebase#230)
Playing around with this code, it seems ```exports.api``` links the path to "/api" automatically, it's redundant to add it in the get/post path and causes the url to fail.
1 parent c524658 commit fab4e33

File tree

1 file changed

+3
-3
lines changed
  • authenticated-json-api/functions

1 file changed

+3
-3
lines changed

authenticated-json-api/functions/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ app.use(authenticate);
4949
// POST /api/messages
5050
// Create a new message, get its sentiment using Google Cloud NLP,
5151
// and categorize the sentiment before saving.
52-
app.post('/api/messages', (req, res) => {
52+
app.post('/messages', (req, res) => {
5353
const message = req.body.message;
5454

5555
language.detectSentiment(message).then(results => {
@@ -69,7 +69,7 @@ app.post('/api/messages', (req, res) => {
6969

7070
// GET /api/messages?category={category}
7171
// Get all messages, optionally specifying a category to filter on
72-
app.get('/api/messages', (req, res) => {
72+
app.get('/messages', (req, res) => {
7373
const category = req.query.category;
7474
let query = admin.database().ref(`/users/${req.user.uid}/messages`);
7575

@@ -95,7 +95,7 @@ app.get('/api/messages', (req, res) => {
9595

9696
// GET /api/message/{messageId}
9797
// Get details about a message
98-
app.get('/api/message/:messageId', (req, res) => {
98+
app.get('/message/:messageId', (req, res) => {
9999
const messageId = req.params.messageId;
100100
admin.database().ref(`/users/${req.user.uid}/messages/${messageId}`).once('value').then(snapshot => {
101101
if (snapshot.val() !== null) {

0 commit comments

Comments
 (0)