https://github.com/codedbystuart/hasura_actions
Getting started with Hasura Actions
https://github.com/codedbystuart/hasura_actions
Last synced: about 2 months ago
JSON representation
Getting started with Hasura Actions
- Host: GitHub
- URL: https://github.com/codedbystuart/hasura_actions
- Owner: codedbystuart
- Created: 2021-02-13T12:07:42.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2021-02-13T12:10:06.000Z (over 5 years ago)
- Last Synced: 2025-01-13T14:52:02.154Z (over 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 16.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Hasura Actions
This is a demonstration of Hasura actions Development
```
npm ci
npm start
```
## Development
The entrypoint for the server lives in `src/server.js`.
If you wish to add a new route (say `/greet`) , you can add it directly in the `server.js` as:
```js
app.post('/greet', (req, res) => {
return res.json({
"greeting": "have a nice day"
});
});
```
### Throwing erros
You can throw an error object or a list of error objects from your handler. The response must be 4xx and the error object must have a string field called `message`.
```js
retun res.status(400).json({
message: 'invalid email'
});
```