The task here was to create a lightweight app, the thinnest possible, that responded to http requests using Express. I used the following process and technologies:
- Set up new npm package:
- Specify app.js as your entry file
- Install Express,
npm install express
. - Create app.js.
- In app.js:
- Create an Express application.
- Define a GET "/" route.
- Instruct the app listen on a port 5000.
- Navigate to root directory of the project,
node app
. - In browser or Postman, make a get request to localhost:5000.
- The response should be a json object {msg: "hello world"}.