hcp-uw / syntext

website for practicing your typing
5 stars 0 forks source link

Creating a working API #13

Closed karhu1 closed 1 year ago

karhu1 commented 1 year ago

To start with, we can follow the youtube tutorial to set up a basic end point for our back end, and then request data to display on the front end.

https://youtu.be/w3vs4a03y3I?t=195

From that timestamp forward he sets up the server file using express, and then moves onto fetching the data with react. Creating this start/template would be really useful later on.

elimelt commented 1 year ago

Thanks to Kai we now have a working development API! (bars)

The basic rundown of how to use it is as follows:

send a GET request to 'http://localhost:3001/devapi/ex?length=~insert length here~', and an object will be sent in the response!

If you want to give it a try, head to the root directory of your local repository on terminal and run the following commands:

image

You've now started your development server!

Next, to request data for a long snippet, open a browser and search the following URL: http://localhost:3001/devapi/ex?length=long

and you should get something like this:

image
elimelt commented 1 year ago

We have since finished all the functionalities of our API needed for MVP. For details, check out syntext/server/documentation