console.log- with function
- with import/export
- with CSS
console.log('%cSomething', 'background-color:purple;color:white;font-weight:bold');
-
const json = fetch("dog_url") -
...
.then response.json() -
...
.then console.log -
run with error
-
add
allow-net=dog.ceo -
show with top level await
server_importconst server = serve({ hostname: '0.0.0.0', port: 8080 });console.log- something about server startedfor await (const request of server)- move fetch code
request.respond({ status: 200, body: 'Find your random dog at ${data.message}' });
oak_importoak_setuprouter.get('/', async (ctx) => {});- move fetch code
oak_responseoak_start- SHOW WORKING
- create file
allTodos.js const filePath='./data/todos.json';all_todos- create file controllers/getTodos
- import allTodos
oak_functiongetTodos200data
const data = await allTodos();- change
main.js - add
--allow-readflag - SHOW WORKING
save_todo- create function in allTodos to save- create addTodo file in controllers
oak_functionaddTodo201'Created'
read_bodytitle
create_idnew_todoawait saveAllTodos([...data, newTodo]);- import statement
- add
.post('/', addTodo);to router - add
--allow-writeflag - SHOW WORKING
- create updateTodo file in controllers
oak_functionaddTodo204'Updated'
const id = parseInt(ctx.params.id);const data = await allTodos();find_todo- write
updatedDatamap script await saveAllTodos(updatedData);- add
.put('/:id', updateTodo)to router - SHOW WORKING
- create deleteTodo file in controllers
- add function same as updateTodo
- add try catch and return error
- add 204 updated response
const id = parseInt(ctx.params.id);const data = await allTodos();find_todo- write
updatedDatafilter script await saveAllTodos(updatedData);- add
.delete('/:id', deleteTodo)to router - SHOW WORKING
- add
--inspect-brk - go to
chrome://inspect - under Remote Target find deno and click inspect
test_importDeno.test('My first test', () => {})assertassertEqualsassertNotEqualsassertThrows- function, Error, 'error message'