This repository contains the source code used in this blog post
npm install codehooks -gClone the example code repository.
git clone https://github.com/RestDB/codehooks-io-examples.gitNavigate to the example app directory.
cd codehooks-io-examples/codehooks-mongodb/myappnpm init es6 -y
npm install codehooks-mongodb codehooks-js codehooks-crudlify express body-parser mongodb debug yup --savenode app.jsInsert a new user record.
curl -X POST \
'http://localhost:8080/dev/user' \
--header 'Content-Type: application/json' \
--data-raw '{
"name": "Ally",
"email": "[email protected]"
}'Run a query agains the database.
curl -X GET \
'http://localhost:8080/dev/user?name=Ally' \
--header 'Content-Type: application/json' Example output.
[
{
"_id": "63fb97825f624f479034eb08",
"active": true,
"email": "[email protected]",
"name": "Ally"
}
]First create a new Codehooks project to hold the app.
coho initNext deploy the app to the cloud.
coho deployVoilá, you now have a backend app that you can develop and run locally, and at the same time deploy directly to the codehooks.io cloud app service.