Build your MEAN project with automatic Express.js management
source link: https://dev.to/scaledynamics/build-your-mean-project-with-automatic-express-js-management-3a79
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Build your MEAN project with automatic Express.js management
Jun 11
・3 min read
Hi there, some of you guys might already know that we built a MERN stack template earlier that helps you skip Express.js.
Regarding some of your requests, we would like to bring you a new open-source template. And this time, it is for MEAN stack 😉
And you know what, you can still develop both front & backend with live-reload and deploy with a simple command-line while the Express.js part is managed 100% automatically, isn’t that great? 🤯
Clone it right here 👉 MEAN ready-to-deploy template
Now let’s get to know how the template can help you!
A MEAN stack but you only code MAN 🤯
Besides the MERN stack that stands for MongoDB, Express, React and Node.js, we still have the MEAN stack for people who use Angular instead of React. It is also considered as a quite popular one for Full Stack JavaScript developers.
Quite similar to the MERN template, this MEAN template is also configured specifically for the ScaleDynamics cloud platform on MIT license. It offers all you need to start developing your MEAN based apps/services:
- One command to develop with live-reload
- Another one to deploy, make your app/service available on a URL
- No Express.js layers management, the platform takes care of them automatically
- No HTTP/JSON coding as our compiler automatically generates its stubs required to call a Node.js function using JS objects.
Don’t forget that you need a ScaleDynamics platform account, you can create your FREE Community account right here).
How to use the template
First of all, clone the template by:
git clone https://github.com/ScaleDynamics/angular-mongodb-template.git
Then you’ll have both frontend and backend template ready:
- On the frontend, you’ll have a
angular-app
web template app created withangular-cli
. To update it, open thesrc
folder where you can add, modify or delete components. - The backend contains a node module and a MongoDB module. You can update the frontend/backend as you need to build your own app.
To start developing with the template, go in frontend/angular-app
folder and run those commands below:
Install the project
npm install
Log in to the ScaleDynamics Platform
Don’t forget to login to ScaleDynamics Platform to start developing. In case you don’t have an account yet, take 2 mins to create a free community account here
npx warp login
Develop with live-reload
Start a live-reload development session by using this command.
npm run start
You can always update the frontend or the backend code, it will be rebuilt at each modification.
Please note that you’ll need to select an existing project or create a new one as you want before running this command. On the ScaleDynamics platform, a project identifies an application or a microservice. For more details on projects, see the documentation.
Deploy with ScaleDynamics
When it comes to deployment, you’ll need to compile and minimize your project for production by using:
npm run build
Then the deploy command
npm run deploy
Now, beside selecting a project, you’ll also have to select or create an environment which identifies the cloud execution environment to run your app. You can create as many as you want like ‘staging’, ‘demo’, ‘prod’... Each environment has its own URL.
For more details on projects or environments, see the documentation.
Configure MongoDB driver
In src/mongodb.js
. There is a template module that you can replace its URI
constant with your own.
const URI = 'mongodb://[username:password@]host1[:port1][,...hostN[:portN]][/[defaultauthdb][?options]]';
You’re all set!
Creating new functions
With ScaleDynamics Platform, new functions can be called by the frontend. Add them in index.js
or into another module and export it. The platform manages the Express.js layers automatically.
const myFunction = () => {
// your code here
}
module.exports = { myFunction };
To access your new functions on the frontend side, adapt this code:
import * as Backend from './.backend/hello.js';
const { myFunction } = new Backend();
Other info
And that’s it! If you need more information, check out these documentations:
We hope you liked it, please let us know if you have any questions or feedback!
Stay tuned for the Vue.js template coming up! you can subscribe, or follow us on Twitter, Facebook and even Instagram for more updates!
Cheers!
Recommend
-
6
Your project doesn't mean your playground Sun, Sep 8, 2013Having your own open source project is awesome. You get to build a thing you like, obviously. But you also get to have your own little playground, a chance to use your...
-
14
You are looking for an easy way to automatically build your application in the Cloud? Then maybe Google Cloud Platform (GCP) Cloud Build is something for you. In this post, we will build a Spring Boot Maven project with Cloud Build, create a...
-
5
Introduction morgan is a Node.js and Express middleware to log HTTP requests and errors, and simplifies the process. In Node.js and Express, middleware is a function that has access...
-
9
Updated on April 8, 2022 How to Build Your First Node.js Website with Express and Pug For most of my career as a Web Developer, I worked on the frontend of websites and applications consu...
-
5
Agile Project Management: How to Build Your First Application Using Agile Joanna Staromiejska December 21, 2022 ...
-
3
Node Weekly Issue 474 « Prev
-
7
Build & Deploy your own REST API with NodeJS and Express Last update: 2023-01-07 Type Tutorial Membership Tech Node.js
-
4
FlowrAgile project managem...
-
3
Introduction: Ever since I have started exploring the topic of Focused Build in SAP Solution Manager, I have got a lot of requests for role specific responsibilities and task of all the stakeholders in SAP Focused Build for managing a pro...
-
0
Launch HN: Dart (YC W22) – Project management with automatic report generation
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK