I wanted to build my MEAN stack in Haxe. So I build this example project to see if its doable.
- Haxe The Cross-platform Toolkit for transpiling to javascript more
- Bootstrap v4.1 for css framework
- Fontawesome v5 for nice icons
- Vue.js a progressive framework for building user interfaces.
- Vue router The official router for Vue.js
- sass CSS with superpowers
- LiveReload chrome extension
- hx-html experimental html template creation
- Swig docs Haxe extern
MEAN is a free and open-source JavaScript software stack for building dynamic web sites and web applications.
The MEAN stack is MongoDB, Express.js, AngularJS (or Angular), and Node.js. Because all components of the MEAN stack support programs are written in JavaScript, MEAN applications can be written in one language for both server-side and client-side execution environments.
MEAN was coined by Valeri Karpov, a MongoDB developer. He introduced the term in a 2013 blog post.
The logo concept, initially created by Austin Anderson for the original MEAN stack LinkedIn group, is an assembly of the first letter of each component of the MEAN acronym.
The components of the MEAN stack are as follows:
- MongoDB, a NoSQL database
- Express.js, a web application framework that runs on Node.js
- Angular.js or Angular, JavaScript MVC frameworks that run in browser JavaScript engines
- Node.js, an execution environment for event-driven server-side and networking applications
A number of variations on the traditional MEAN stack are available by replacing one or more of the components with similar (typically Javascript-based) frameworks. For example: In a MEEN stack, the JavaScript MVC framework Ember.js is used instead of Angular, and likewise for the MERN stack, where React.JS is used as a substitute.
(M) | (E) | (A) | (N) |
---|---|---|---|
MongoDB | Express | Angular | NodeJS |
React | |||
Vue.js | |||
Swig | |||
Jade |
Pre-requisites You need to have a basic understanding of all the four technologies that make up the MERN stack. You should also have npm (Node Package Manager) installed. This is NOT a tutorial on MongoDB, Express, React or NodeJS.
Easy way to make AST files for .json
http://matthijskamstra.github.io/hxjsondef/
Normally you can install with
haxelib install
But some stuff that doesn't install automaticly by haxelib. You can fix that with the following commands
# haxe-js-kit for externs
haxelib git js-kit https://github.com/clemos/haxe-js-kit.git haxelib
# I sometimes use my personal set haxe-externs
haxelib git hxexterns https://github.com/MatthijsKamstra/hxexterns.git
# cutting edge vue.js externs
haxelib git vue https://github.com/MatthijsKamstra/Vue.hx.git
- package.json (I only use this for `watch`)
+ bin
- package.json (here are your files node.js needs to work)
This will start:
- mongodb
- open mongobooster
- open browswer
- watch css/hx
- nodemon
npm run start:lazy
npm run watch
→ mongod --version
db version v3.6.3
git version: 9586e557d54ef70f9ca4b43c26892cd55257e1a5
OpenSSL version: OpenSSL 1.0.2o 27 Mar 2018
allocator: system
modules: none
build environment:
distarch: x86_64
target_arch: x86_64
http://mongoosejs.com/docs/compatibility.html
- MongoDB Server 3.6.x: mongoose 5.x, or >=4.11.0 with useMongoClient and usePushEach
- MongoDB Server 4.0.x: mongoose >=5.2.0
MongoDB works with Mongoose
Express
Node.js
Some prefer a different templating system.
- Use static files
- Server generated templates
- Client generated templates
Use templates to generate them on the server and send the template to the client
- Swig docs Haxe extern
- Jade (is now called Pug) Haxe extern
- ejs Haxe extern
- Mustache
- react
- vue.js
- (Angular)
- Haxe default templating http://api.haxe.org/haxe/Template.html
- https://github.com/nadako/hxmustache
- https://github.com/haxetink/tink_template
- https://github.com/benmerckx/ithril
- https://github.com/ciscoheat/mithril-hx
https://github.com/clemos/haxe-js-kit/tree/develop/js/npm/mongoose
https://github.com/clemos/haxe-js-kit/tree/develop/js/npm/socketio
https://github.com/clemos/haxe-js-kit/tree/develop/js/npm/express
https://github.com/MatthijsKamstra/hxexterns
https://github.com/wiggin77/HxMongoNode
https://github.com/abedev/hxexpress
https://www.npmjs.com/package/@types/express
https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/express
https://microsoft.github.io/TypeSearch/
https://www.npmjs.com/package/@types/mongoose
https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/mongoose