It is enough to find a bijection between $\mathbb{N}$ and the set $\mathbb{Q} \cap (0, 1)$ of rational numbers lying inside the unit interval. Since after we have such a bijection $f: \mathbb{N} \to \mathbb{Q} \cap (0, 1)$, we could compose this bijection with the function $x \mapsto \frac{1}{x} - 1$, which "stretches" the unit interval $(0, 1)$ to the half-line $(0, \infty)$, giving us a bijection $g: \mathbb{N} \to \mathbb{Q} \cap (0, \infty)$. I'll leave it up to you as to how to get a bijection $h: \mathbb{Z} \to \mathbb{Q}$ once being given such a $g$.
So, how to construct this first function $f$? We simply make a big list of every rational number between 0 and 1, ordered first by their denominators, and then by their numerators. We make sure to only write the fraction $p/q$ down into this list as long as $p$ and $q$ have no common factors. The start of the list looks like this:
$$ \frac{1}{2}, \frac{1}{3}, \frac{2}{3}, \frac{1}{4}, \frac{3}{4}, \frac{1}{5}, \frac{2}{5}, \frac{3}{5}, \frac{4}{5}, \frac{1}{6}, \frac{5}{6}, \frac{1}{7}, \cdots $$
and define $f(n)$ to be the $n$th fraction in this list. You need to show that $f: \mathbb{N} \to \mathbb{Q} \cap (0, 1)$ is both injective and surjective, and there are a bunch of ways of doing this. Injectivity should follow from the fact that a positive rational has a unique representation as $p/q$ for $p, q \in \mathbb{N}$ having no common factors. Surjectivity will rely on the fact that $p/q$ appears in this list after finitely many terms.
By the way, for an example of where surjectivity would fail, consider the "list" of fractions
$$ \frac{1}{2}, \frac{1}{3}, \frac{1}{4}, \frac{1}{5}, \ldots, \frac{2}{3}, \frac{2}{5}, \frac{2}{7}, \ldots, \frac{3}{4}, \frac{3}{5}, \ldots $$
This list still defines a map $f: \mathbb{N} \to \mathbb{Q} \cap (0, 1)$, but there is no $n \in \mathbb{N}$ such that $f(n) = \frac{2}{3}$, since we would have to write down infinitely many terms before $\frac{2}{3}$.