KenEucker / biketag-website

A website for biketag.org
https://www.biketag.org
GNU Affero General Public License v3.0
32 stars 15 forks source link

Create api endpoints for templates #3

Closed KenEucker closed 4 years ago

KenEucker commented 6 years ago

What We could do serverside rendering for any kind of template and then those can sit at a JSON endpoint, that the app then consumes. The first two templates to build are the postedTagTemplate and the redditPostTemplate. These endpoints will receive a POST request with some data and return the template with the data, the template without the data, and the data inside a JSON object.

Why The templates for data on the biketag site shouldn't be in the templates for the sites, let's put them into their own templated endpoints and allow for different views of the same data. This also allows us to get templates based on our data to do migrations and historical post imports more simply.

How Use a templating engine? Output can be any text whether it be html or not.

KenEucker commented 4 years ago

There is one web endpoint for the Reddit template, located at http://biketag.org/get/reddit.

KenEucker commented 4 years ago

Another ancillary update here: With the implementation of ejs templating in the app, we can more easily support this feature request.

Specifically, starting with the /get/reddit endpoint, it should be rewritten as an ejs view that is served instead of the raw HTML being compiled by the appcode.

KenEucker commented 4 years ago

Following up on the last comment. The /get/reddit endpoint now serves via an ejs template. Closing this issue for now, as previous experiments using SSR and Hypernova were unnecessary and bloated.