Say I have a web dir someserver.com/json/ that has directory listing enabled.
And say in that directory I have several <vcenter name> directories.
And say that in each someserver.com/<vcenter name> directory there is a bunch of JSON files.
Assuming that my AngularJS app is running on someserver.com.
Is there a way in angularJS to get a listing of the vcenter dirs and json files within?
I plan to build an web app that parses info from all the JSON files and formats them into individual tables.
Related
I'm having an express app that serves EJS files, now i wanted to add one more framework called next js(server side rendering framework). Is there any way of routing that supports next js and ejs through express.
First, create the views folder as you would normally do in EJS and then create a SUB-FOLDER within it called pages and you can create another sub-folder under views for your template/partials folder.
I attached 2 images with examples of the folder structures: Eaxmple 1 Example 2
You will find a template for the folder structure in this GitHub link:
https://github.com/petranb2/masterEJS
Here is a medium post that details the project implementation of related to the above GitHub template: https://medium.com/swlh/master-ejs-template-engine-with-node-js-and-expressjs-979cc22b69be
The link below is a free e-book where you will find an even more detailed example of a project that author converted from just EJS to EJS and Next.js.
https://subscription.packtpub.com/book/web_development/9781785888434/1/ch01lvl1sec12/restructuring-the-views-folder-using-partials
I have added some json file to my library, but when I build it there is error my.json file not under rootDir.
Assuming you want to access the .json file as part of the application build process (i.e. not via http), you will will need to put it into the assets folder in your project.
More information about the folder structure of an Angular application here.
You can then follow the instructions here to access the data from your components.
I have a project created by vue-cli3. Now I have some files that I use during development, but I don't need them in a production environment.
eg:
I put a file named test.html into /public, and I could access it using http://localhost:8080/test.html (assume project running at http://localhost:8080). When I generate a production version, I don't want this file got included in /dist(default output dir).
All files under /public will be copyed to /dist/static, but it is not the result I expect.
How can I do to get access some files when developing but don't get them involved in production?
Hi I'm creating a simple framework that needs to loop through a folder, that is stored in the www folder, in my phonegap project. At the moment I'm using the fileSystem.root to list al files in a folder but as root suggests, it only shows all the items in my phones root folder. Is there a way to get the directory of the www directory?
Since in PhoneGap app your app runs in the webview with www directory, you can simply extract the www path as below:
var wwwDirectoryPath = window.location.href.substring(0, window.location.href.indexOf("/www"));
It will give you the folder path in which 'www' folder resides.
The content of the www folder is read only. There is no need to read the content at runtime as it is always the same. It would be better to read the files during build phase and save the result in a JSON file or something that you include in the app.
I'm working on a js project that follows this directory structure:
/doc
/src
/test
/etc
This client-side js app can be configured by a server app (a whole separate application) via json. We define the structure, attributes, attributes description and allowed attribute values for that json data using some xml files. Those xml files are parsed by the server app so it can send a correct json object.
Should I create a new "dist" directory for that xmls as they are distributed to the server app team. Or should I put them in my doc directory as they in some way document the interface between the server and client apps. Or should I do something different? I'm asking for best practices.
Sounds like these files are a resource, so I would put them underneath a resource directory. Probably something like /src/resource or /resource.