Today we're launching a beta of our Custom API.
All you need is a api/ folder where you have your functions. Each file is going to resolve to an endpoint automatically.
In the file you write your handles like this:
module.exports = (req, res) => {
res.json({
body: req.body,
query: req.query,
cookies: req.cookies,
});
};
With custom APIs released a Nhost project now consists of:
Custom API was by far the most upvoted feature requested by our users and and important feature to build apps with Nhost.
We're hosting everything on Google Cloud Run and will allow customers to bring their own Dockerfile in the future.
Read more about our Custom API here: https://docs.nhost.io/custom-api