This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import chai from 'chai'; | |
| import chatHttp from 'chai-http'; | |
| import 'chai/register-should'; | |
| import app from '../index'; | |
| chai.use(chatHttp); | |
| const { expect } = chai; | |
| describe('Testing the book endpoints:', () => { | |
| it('It should create a book', (done) => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| language: node_js | |
| node_js: | |
| - "stable" | |
| cache: | |
| directories: | |
| - "node_modules" | |
| install: | |
| - npm install | |
| services: | |
| - postgresql |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "name": "book-app", | |
| "version": "1.0.0", | |
| "description": "", | |
| "main": "index.js", | |
| "scripts": { | |
| "dev": "nodemon --exec babel-node ./api/index.js", | |
| "test": "export NODE_ENV=test && sequelize db:migrate:undo:all && sequelize db:migrate && nyc --require @babel/register mocha ./api/test/test.js --timeout 20000 --exit", | |
| "build": "rm -rf ./build && babel -d ./build ./api -s", | |
| "generate-lcov": "nyc report --reporter=text-lcov > lcov.info", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import "fmt" | |
| //Package scope array definition | |
| var integerArray [5]int | |
| var stringArray [4]string | |
| func main() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import "fmt" | |
| func main() { | |
| //Function scope array: | |
| integerArray := [5]int{10, 20, 30, 40, 50} | |
| stringArray := [4]string{"first", "second", "third", "fourth"} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import "fmt" | |
| //Package scope array definition | |
| var integerSlice []int | |
| var stringSlice []string | |
| func main() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import "fmt" | |
| func main() { | |
| //Function scope slice: | |
| //EXAMPLE 1: | |
| integerSlice := []int{10, 20, 30, 40, 50} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import "fmt" | |
| func main() { | |
| s := make([]int, 4) | |
| s[0] = 10 | |
| s[1] = 20 | |
| s[2] = 30 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import "fmt" | |
| func main() { | |
| s := []int{10, 20, 30, 40} | |
| // We can loop through this slice in two ways: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import "fmt" | |
| func main() { | |
| //Example 1: | |
| nested := make([][]int, 0, 3) | |
| for i := 0; i < 3; i++ { | |
| out := make([]int, 0, 4) |