https://github.com/codedbystuart/hasuraactions
Hasura Graphql custom business logic (Actions)
https://github.com/codedbystuart/hasuraactions
Last synced: about 1 month ago
JSON representation
Hasura Graphql custom business logic (Actions)
- Host: GitHub
- URL: https://github.com/codedbystuart/hasuraactions
- Owner: codedbystuart
- Created: 2021-04-10T10:28:01.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2021-04-10T11:50:50.000Z (about 5 years ago)
- Last Synced: 2023-03-11T04:19:40.464Z (over 3 years ago)
- Language: JavaScript
- Homepage:
- Size: 36.1 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Hasura Actions to make Payments (Nodejs and Express)
This is a starter kit for `nodejs` with `express`. To get started:
Firstly, [download the starter-kit](https://github.com/hasura/codegen-assets/raw/master/nodejs-express/nodejs-express.zip) and `cd` into it.
```
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 errors
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'
});
```