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 Build a REST API With Express Building API Routes in Express Building the Question Routes

nishantr
nishantr
6,326 Points

what are the routes for my app?

I am writing a weather application using express and as we have /questions and /answers routes for this QA app, what are the routes i need to write for my weather app? my app takes the input from the user( the location which they want to display the weather) and it fetches the data from openweathermap.org to display the weather in my app.

I just finished this course. If you are creating a weather API, are you planning on letting other people outside of your site use this API? If so, I would wait for them to release their next Node Express course this month that deals with securing express apps.

Have you written down or planned out the different descriptive tasks that an app might expect to make or request back?

For example: Get weather from a city

GET /weather/byCity/:cityName

Get conversational with yourself and figure out what the goal is, what type of questions your app might ask for and what they might expect back.

Good luck on your API!

2 Answers

No problem! Let me know if you need any more help.

As a consideration, if you are just building a single web app, you will need to run one server for the frontend and one server for the API. If that's the case and you don't expect outside use, you might want to consider making a regular express server and not an api. It's very similar and they have great a great course for express apps.

nishantr
nishantr
6,326 Points

Thank you very much, Donnie. Can I have your e-mail ID, please?

nishantr
nishantr
6,326 Points

Am i need to connect my app to database? since I am not storing any data and just retrieving the data from the openeweathermap.org.

No, you don't need a database unless there is data to be stored or retrieved. You could use the database as a way to store uses to watch for extreme access to your API if you intend to leave it open to the internet or store statistical data to return statistical data based on area and use, as an example.

nishantr
nishantr
6,326 Points

Thank you donnie