Skip to content

Instantly share code, notes, and snippets.

View canuto's full-sized avatar

Knut Martin Tornes canuto

View GitHub Profile
@canuto
canuto / index.js
Created November 20, 2022 17:54
Create a CRUD REST API backend using codehooks.io and codehooks-crudlify-yup
/*
* Minimal CRUD API code example using Yup schema
*/
import app from 'codehooks-js'
import crudlify from 'codehooks-crudlify-yup'
import * as yup from 'yup';
// "product" schema allowing any json object
const product = yup.object().shape({
json: yup.mixed()
@canuto
canuto / restdb cURL
Created July 5, 2021 18:06
curl restdb example
curl --location --request POST 'https://xxxx-edf3.restdb.io/rest/employees' \
--header 'apikey: xxxxx' \
--header 'Content-Type: application/json' \
--data-raw '{
"ecode": "bbbbbb",
"lname": "Tester",
"address": "home street",
"fname": "Test",
"active": true,
"email": "tester@tester.com"
@canuto
canuto / test.js
Created September 26, 2012 18:26
TestGist for Knowit Labs
function test(){
}
@canuto
canuto / dummy.js
Created September 19, 2012 13:29
Dummy gist
var getArticleLoadOptions = function(){
return {
"url": currentArticleUrl,
"data": { _ajax: true },
"type": "GET",
"dataType": "html",
"beforeSend": setRequestHeaders
}
};
@canuto
canuto / tasks-spec.coffee
Created September 18, 2012 08:15
Mocha test for simple task REST API using supertest
request = require 'supertest'
assert = require 'assert'
app = (require '../../app').app # remember to export app from your app file!!
before(done)->
# some code to remove all tasks
# ...
done() # asynch callback to tell mocha to go to the next step/spec
describe 'simple todo API',->
@canuto
canuto / test.html
Created September 5, 2012 14:06
Her er hvordan du koder i html
<html>
<h1>hei</h1>
</html>
@canuto
canuto / labstestspec.coffee
Created September 5, 2012 11:27
knowitlabs test
it 'should fetch items from capsule',(done)->
capsuleservice.fetchItemsFromCapsule requestMock, null, (err,items)->
if not err
items.should.have.lengthOf 4
done()