Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript

Sandy Wright
Sandy Wright
15,618 Points

Creating a simple front-end for an Express/mongo REST API

Hi All!

This may be a stupid question, but i'm a full stack JavaScript noob and I am not sure how best to approach this problem.

After completing the fullstack JavaScript track, i've started building my own REST API. Using Express and Mongo - i've created a simple application that allows users to:

  • GET a list of locations
  • POST a new location
  • GET a list of individuals within that location
  • POST a new individual to a location

Following the Treehouse course, i've set up all the necessary routes and have checked the JSON outputs using Postman.

I would now like to create a simple web front-end for this API. But I am unsure what the best options are in order to do this.

I started creating simple jade/pug templates that handled the Login/Register routes. But when it comes to dynamically displaying the 'location' and 'individual' list data - i'm at a lost of what would be the best (/simplest) option available to me.

I've started looking at Angular and React, but felt that there must be a simpler way to parse and display JSON data on a webpage (that I can then manipulate with bootstrap).

Any advice/recommendations would be much appreciated!

Let me know if I can provide any further information or clarifications

Sandy

1 Answer

If you don't want to use Angular or React for this, you can parse JSON data directly with JavaScript (hence JavaScript Object Notation). I have provided a link to W3Schools examples, but depending on how complicated you application is, parsing and displaying your JSON this way may not end up being the best or simplest option. Try it out though, and see how it works. Good Luck!