API token as Query string

 app.use("/api", (req, res, next) => {

  let { token } = req.query;
  if (token === "giveaccess") {
    next();
  }
  res.send("ACCESS DENIED");
});

app.get("/api", (req, res) => {
  res.send("data");
});



Comments

Popular posts from this blog

DATABASE RELATIONSHIPS

ROUTING (GET /) home route

Query Strings