Public route called from outside


how can i create a public route called from outside (link unsubscribe newsletter) that deleted a record?

Project Name: PM
meta": {
“database_type”: “mysql”,
“liana”: “forest-express-sequelize”,
“liana_version”: “6.4.0”,
“engine”: “nodejs”,
“engine_version”: “14.5.0”,
“framework”: “express”,
“framework_version”: “~4.16.3”,
“orm_version”: “5.15.2”

Hi @cliosuper :wave: Thank you for your feedback!

You could definitively add a route to your backend since it’s based on Express.

For instance, you could add these few lines at the very end of the app.js file, just before the last statement (e.g: module.exports = app;):

app.get('/unsubscribe', async (req, res) => {
  const { email } = req.query;

  await unsubscribeUser(email);

  res.send(`${email} has been unsubscribed`);

Then you could call this route via:

:point_right: I would not recommend just doing this here, since the project you created for Forest Admin is just an API: it has not been designed to display public HTML pages. When users click on a unsubscribe link from their mailbox, they are usually redirected to a website that displays success in their browser. In other words, you could create this route, but I would suggest creating also a front end for this need elsewhere.

Let me know if you have any more questions! :pray: