At Enyosolutions, We are fans of sailsjs as a framework for nodejs projects. However over the years we've come accross some issues were painfull :
- Slow startup time (compared to pure express, even express with similar middlewares)
- No nested services / Controllers folders
- Complex to interact with express
- No support for the next option of express
- No support for error handlers
- No proper support for typescript
Also since we don't use waterline and websockets it was an unnecessary addition that slows startup time. Hence we started this project as an attempt to have a startup template for our projects that would support all the important features we like from sails without the rest (that could be made available in the future via a package).
- Routes binding to controllers via config
- Merged configuration files
- Globally available axel (with controllers loaded inside)
- Globally available and merged configuration object
- Policies for routes (in route definitions and in policies file)
- Middleware auto wiring
- Websockets as a plugin
- Nested controllers
-
Nested serviceswe are not doing that. it's better to import services, to avoid polluting the global namespace. - Loading models and wiring an entity manager.
- Connecting to the command line in order to sync models
- Generate bare controllers (connected to the crud controller)
- Generate mongoose controllers ?
- Move manager.ejs to axel folder, and enable the websocket only if config is enabled
- rename axel into trex ?
- typings are not correctly created after you import sequelize types, we need to delete them.
- Generated references in sequelize definitions can create cyclic dependencies. Delete them and define associations instead.
- Case issues when importing a model from database. We end up with underscore cased field, which is for some people not desirable (eslint/airbnb recommends camelCase)
- Url in schemas should be lower or snake cased
Get started developing...
# Install deps
npm install
# Setup environment
cp .env.test .env
# Create the local configuration file
cp api/src/config/local.js.dist api/src/config/local.js
# Connect to db and add token
vim api/src/config/local.js
# Run in development mode
npm run dev
# Run tests
npm run test
Install all package dependencies (one time operation)
npm install
Create the .env
file at the root (example can be found in the .env.test
file).
Enter the MySQL database config and a token (for JSON Web Token) in api/src/config/local.js
(sqldb
section)
Runs the application is development mode. Should not be used in production
npm run dev
or debug it
npm run dev:debug
Starts it in production mode.
npm run start
Run the Mocha unit tests
npm test
or debug them
npm run test:debug
- Open you're browser to http://localhost:3000
- Invoke the
/examples
endpointcurl http://localhost:3000/api/v1/examples
npm run dev:debug
npm run test:debug
Add these contents to your .vscode/launch.json
file