Recommended approach for admin site and front end using MEAN stack? - node.js

I want to build a website using the MEAN stack and my database schema will be defined using Mongoose. This website will have an admin site, in which I will have all the CRUD operations for the data displayed by the frontend website. As the object model will be the same, if I'm using Java or C# I would compile this classes in a Jar or Dll and use it in my frontend site, along with the DB definitions and repositories (say hibernate)
What will be a recommended approach for reuse this object model in this MEAN scenario? Is it common to have another "folder" in my express setup? What if I want to run the admin site on another port?

I see you have no response yet, one example; Here is a nice scaffold that im working with which uses also JS, not C or Java and is a fairly good example of what your looking for i think. This will help you expedite, expand and go in which direction you want from there, by being a very adjustable MEAN stack scaffold using MOngoose, having CRUD examples, and even Bootstrap Jade SASS front end to help facilitate if you want to use it.
You would separate out your admin site as one of the MVC sections, and so forth, just like you would on any other MVC site pretty much, you can just follow the code standards in the documentation there.

Related

How to customise the Admin panel in Keystone JS? (Or: how do the custom admin pages in Keystone JS demo-project/blog work?)

We are looking to use KeystoneJS in a large project and we want to be able to customise the Admin panel. There's a nice example of how to do it here, and I've been reviewing this PR to the project. Although the example looks as if it would work for us, I don't understand the logic behind it, that is, what we would need to implement to make it work, what the possibilities and constraints are.
Is it the case that when you use the Keystone NextJS app (which is good for us), if you add a folder /admin/pages the Keystone app will look there and use those custom admin pages instead of the regular ones? I'm assuming we have full access to the rest of the app, the controllers, the DB from these pages as well....
I also noticed that JedWatson notes in https://github.com/keystonejs/keystone/pull/1019 that
Note this lacks SSR support, and I didn't put as much effort into the examples, but it's otherwise (I think) identical in functionality.
Does it lack SSR support just for the admin part, or does adding custom admin pages somehow affect SSR support in the rest of the app? (SSR is the reason we're using next)
Thanks for any info.
There are two api for custom pages, one is pages option in the admin-ui app constructor and 2nd is part of hooks api in keystone constructor.
pages: this one is legacy and only adds custom pages, it does not overwrite the existing list pages in admin-ui it only hides them if not properly configured. usually the Dashboard is visible and all lists are listed there.
hooks: this is new and expected to add more customization options, unfortunately my PRs are stale and they are not the spec keystone core team would want to add. this also does not removes any pages.
admin ui runs as react app built or loaded using webpack config. that is why there is no ssr support. even though the example use a custom admin directory but that not loaded by nextjs component, it is loaded dynamically using webpack server mounting the admin-ui react app
if you really want to have ssr, you can use some learning from closed PRs which were used as POC long ago. but that would be overkill as the admin-ui has many more updates after that.
hooks/pages have access to core limited set of access, there are some access based on React context, provider and consumer hooks. You can use react-apollo hooks as there is already provider wrapped at root of react context. you can also make use of react router hooks, they are upgraded to latest version. it has no access to server side context or controller. (not sure what you meant by controller)

how to connect nodejs code with custom cms

i want to make Content Management System that can run on nodejs code.help me out in this project .I know that cms is written in php but i want to add the functionalities with the help of nodejs or expressjs.help me in connecting the cms application with nodejs .
CMS is a type of application, and is not uniquely written in PHP. Developing the entire content management system is a large project with many moving parts. To get a sense for how involving it is, you can take a look at this example project where somebody walks you through one particular way of implementing a content management system in NodeJS. However, your implementation will vary depending on your goals of the CMS you are looking to develop.

How to deploy TerriaJS on my site

I would like to deploy an instance of TerriaJS on my site for the purpose of 3D (with 2D-fallback) geospatial mapping. I am a bit confused as to how to actually "deploy" TerriaJS on my site. I am very familiar with Leaflet... pretty much just include the leaflet.js file, create a div, and off you go. However, I am running through the wiki on TerriaJS's github page and all I see is a bunch of NodeJS.
What am I missing? I am able to get the map to run with NPM and I see a nice 3D map (running inside of a node web server instance), but that doesn't do me any good as I want to be able to embed the map on my web site.
If anyone has a nice (plain English) tutorial or starting point, that would be awesome.
Thanks.
The Node-based web server that we usually use with TerriaJS only does a few things:
It serves up the static HTML, JavaScript, and CSS that make up the application.
It includes a simple service at /proxy that allows TerriaJS to access geospatial data servers that don't support CORS.
It includes another service at /convert that uses OGR to transform geospatial vector data (e.g. shapefiles) to GeoJSON for display by the TerriaJS client.
Of these, only the first is required. So, you can copy the wwwroot directory of a working TerriaJS application up to whatever web server runs your site and it will run there just as well as it does on the Node-based server. You'll have to make sure that all of your geospatial data is either on the same server or is hosted on servers that support CORS, and shapefile conversion won't be supported, but other than that you should be good to go.
Embedding TerriaJS in an existing web page is a bit trickier. You'll want to start with the index.js, index.html, and index.less files in the TerriaJS app you started with (NationalMap maybe?) and modify them to suite your needs. You'll need to use the gulp-based build process. But once that is all done, you can just copy the files up to your web server as before.
Depending on your needs, you may also consider embedding TerriaJS on your page in an iframe rather than building it into the page directly. You can control the content of the catalog and customize some basic aspects of the UI by specifying parameters to the URL. You can also control it by posting cross-window messages as described here.
Finally, it's possible to use TerriaJS without the provided user interface, e.g. by providing your own. This is a pretty advanced scenario, though, so probably best to post a separate question if you want to go down that road.

How do I create transferable dll's for a specific website functionality?

VS2013 update 5, MVC5 using Areas
I have a stand-alone function programmed for a website. The functionality is a specific user interface to collect survey responses in a particular way. It has several controllers, a model and a group of views. The functionality is completely contained in an Area of the project, except for the Shared _Layout file that provides the main menu for consistency.
'Is it possible for me to' / 'how do I' compile this Area into a single or set of .dll file(s) that I could then add conveniently to other websites? I'm assuming creating something for transfer/download is very standard functionality. For example, I used Elmah.MVC for this site. What I want to do is pretty much create a package that can be downloaded in a similar way to how we integrate Elmah.MVC into a site. (Be certain I'm not talking about creating error logging software, I'm only using Elmah.MVC as an example of software that is easily integrated into other website applications.)
I've never compiled any website functionality into a .dll(s) for use elsewhere and would appreciate either some specific guidance, or perhaps what would be easier is to provide a link with a good step by step tutorial or explanation for how to do this. Most of what I've found on the web describes bits and pieces of doing this, but it's not enough for me to feel confident with it.
It seems to me there are a lot of 'moving parts' to taking a particular piece of an MVC application and turning it into something that is easily added to other projects.
A particular issue I don't quite grasp is the difference in downloaded packages between getting code and getting just the .dll(s). For instance, when I download an MVC5 site, I get controllers, models and views, but when I download Elmah I get a .dll and no code files. Also, I do understand the concept of transforms, but I'm just struggling right now with even getting from my programmed application into a 'package' regardless of the transforms that make it easy to integrate into another website.
These are just some of my questions I have about how to perform this particular process in developing deliverable and/or shareable software.
What you are looking to do is create a portable MVC Area project. A Portable Area is a set of reusable multi page functionality can be dropped into an application to provide rich functionality without having to custom build functionality that is literally the same in every application. An MVC Portable Area is really just a dll that contains the views, controllers, scripts, etc… needed to use in a website that is either a Web Forms website or an MVC website. A developer can use them for a reusable widget or a complete engine. I have actually used them for both. Here is a link with some basic info to get started. http://elegantcode.com/2012/04/06/mvc-portable-areas/

What is the kohana framework used for?

I´m learning kohana for the first time and need to know some basic facts about the mcv principle.
Up until now i´ve only used Javascript frameworks (ext, openlayers etc) which are referenced in the headers of html pages. The classes are then extracted and used in applications. I can have as many separate applications referencing one Ext.js framework installation as I like.
Kohana,as an mvc framework, is obviously different, but which purpose does it fullfill? Is it used to create web applications inside the Kohana installation ie. one web application...or is it used to create an endless number of applications? As far as I can see, one downloads the kohana framework, and adapts/extends the framework to make an application..e.g. a web cms. Am I on the right lines?
cheers,
Rob
The Kohana framework is typically used to build a web application. You would normally use one Kohana install and work with that to make a web application.
You could if you wanted, install Kohana centrally in somewhere like /usr/share/Kohana
Then you would move the application folder out and set the update the paths in index.php to the right places (there is a system path, module path and application path).
MVC allows is a design pattern for separation of business logic (model), controller (uses the model to get data and pass it to the view) and the view normally is what is outputted to the browser (HTML). You can read more here
http://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller
Yes, typically each web application has its own copy of a library. So, one copy of Kohana is extended to one web app.
MVC is a pattern that is common in web frameworks. It leads to better code reuse and lose coupling among different parts of the app.

Resources