index
is where the server code is pulled together, using ./routes/index.js'.
β There is a list of routes, which are variously called 'URLs', 'endpoints' and 'an API'. Strictly an API is a collection of URLs or endpoints which provide some functionality. In this case, the API gives access to our server which is what manages the link to the database. In this way, the database is protected from external attack (you have to sign-in to get in), the logic to handle database actions is controlled and can be changed independently of the PT website. For example, we could switch to a different database and the website would not even know.
β The routes are defined as GET and POST options, which signify requests for (GET) or submission of (POST) data.
Each route has an associated function, which provides data security checks and carries out the requested actions.