Ghost Custom Functions - Server


#1

I’m trying to understand how Ghost works, its data structure and without touching the core. I’ve looking at the docs to get an idea on how to go about what I want to achieve.

In post.hbs, in a <script> tag, I want to make an AJAX call (GET, POST or PUT) to a function that returns data or does something. I dont know where to place that function. Also that needs a url to get to. That function should not be a client; it should be the server. How to achieve this? Possible?

ie: From the client, I send an api key to the “server” that gets a Twitter data, then returns that information where I update the DOM.


#2

I’ve figured it out:

1: Create an app and register it
2: In the app, register a route
3: Give route permission

Ghost is awesome :fist:t4:


#3

What are you looking to build?


#4

Hi. I’m relatively new to Ghost and nodejs so I’m toying around the Ghost application.

I’m building a firebase commenting system which currently works. Since Im still limited on how the Ghost App works, most of the files that make up the firebase commenting are not in the app directory. I use the app directory for server-related functions such as get Twitter details, sending mentions notifications etc.

I’ve registered a route /twitter/:apitoken then use axios to make a POST request. One issue I face is with express. I see no option to make the paths caseSenitive: true

My :apitoken param keeps lowercasing and I don’t want that. I’ll explore in greater detail later :wink:


#5

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.