Comments (12)
nevermind I see what you mean
from spf-express.
@Arthelon I have an idea, can you add in a feature where you can specify the json in the route, that way I can read files as the route is requested.
from spf-express.
@newtsrock can you clarify what you mean? You can already specify json to be returned at each route.
from spf-express.
For example you could do
app.get('/', (req, res) => {
// Include middleware function here
// Include SPF JSON per each route inside middleware function
res.render('layout', {
// Instead of middleware function you could include the SPF JSON here in an SPF object.
})
})
from spf-express.
Having to write your own express middleware defeats the purpose of this mini library. I still don't understand the res.render() example. Why are you trying to inject an SPF object into the template layer?
from spf-express.
Mainly because when I'm using the library and have to update the partial I'm loading into the object, I cant do it on a per request basis. I'd prefer a feature for that because when I load in the object in the middleware, it only gets requested once. Everytime I make a change to the partial, I need to restart the server because like I said, the middleware only gets loaded once.
from spf-express.
Btw the partial is the html content I'm swapping out
from spf-express.
@newtsrock It seems like you need hot module reloading or similar behavior. This would be too specific of a feature to implement. This library might be able to help for your use-case.
from spf-express.
Sounds good, I'll try it when I get home.
from spf-express.
@Arthelon I now need the library for dynamic data, I don't want the server to restart to get new data that gets fetched once per restart. Can you please consider my suggestion as that would be easy for me and my uses for it.
from spf-express.
Why is data being fetched once per restart? That implies that the fetching isn't being linked to any endpoints The library allows you to handle dynamic data by supplying an express middleware function to a path.
from spf-express.
@Arthelon I'm afraid I don't get what you mean, can you leave a sample?
from spf-express.
Related Issues (3)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from spf-express.