From the course: Building Vue and Node Apps with Authentication

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Creating a service

Creating a service

From the course: Building Vue and Node Apps with Authentication

Start my 1-month free trial

Creating a service

- [Instructor] In this video, we'll create an endpoint that serves all of our messages. We no longer need this test endpoint, so we'll modify line five to get what we want. The first thing we'll modify is the location. So instead of slash for root, we'll specify slash messages. Then instead of simply sending a response got send with test string, we'll get rid of that, and we'll put in a new block. Then we'll go to our front end project in our other editor, I'll scroll down, and I'll grab line 17 that has our messages. I'll copy that, and I'll create a new constant called messages, and I'll set that to the messages we copied. Then I'll use a response.send and I'll pass in the messages. So I'll save that, and rerun node. So I'll shut it down with control C and start it up again. But instead of doing that, we can use node mon and specify our server. Node mon is a command line tool that automatically scans for any saved changes and restarts node. I currently don't have it, so the first…

Contents