How do I make a shader to line the triangles in the mesh?

I am currenty trying to get intro shaders and got stuck when I was trying to make a shader that lines the edges of the mesh like in the screenshot.

Thanks

alt text

Here’s two possible approaches: