Express.js vs Slim
When comparing Express.js vs Slim, the Slant community recommends Express.js for most people. In the question“What are the best web frameworks to create a web REST API?” Express.js is ranked 1st while Slim is ranked 12th. The most important reason people chose Express.js is:
Setting up a new Express project is very easy. It consists of installing a handful of libraries through NPM run a single `npm install` and everything is ready to go.
Specs
Ranked in these QuestionsQuestion Ranking
Pros
Pro Setting up is very easy
Setting up a new Express project is very easy. It consists of installing a handful of libraries through NPM run a single npm install
and everything is ready to go.
Pro Great routing API
Express' extremely powerful routing API allows developers to do tasks ranging from building a REST API to building the routes for a simple web app and then take it to the next level by using route parameters and query strings.
Pro Great for beginner Node.js programmers
With a little learning curve, it is a good choice for new NodeJS developers to get started quickly. Express boasts great, thorough documentation.
Pro Express.js is in the Node.js Foundation Incubator Program
Node.js Foundation
Announcement here
The Node.js Foundation is a Collaborative Project at The Linux Foundation. Linux Foundation Collaborative Projects are independently funded software projects that harness the power of collaborative development to fuel innovation across industries and ecosystems.
Pro Relatively mature
Being a somewhat old Node.js web app framework and being one of the most widely used frameworks, Express.js has matured quite a lot during all that time. It's more stable than its competitors and a huge community backing it.
Pro Support for a lot of plugins
Express takes advantage of Node's NPM to distribute and install countless plugins made by third parties which solve almost anything a developer would want to do with Express.
Pro Has the largest userbase
It's by far the most popular framework for node.
Pro Great supportive community
Express has a big community with a lot of guides and tutorials written about it by developers that have been using it for quite some time.
Pro Good Oauth/Facebook integration with connect module
You can easily add oAuth integration/social logins to your next web app without much hassle, using this authentication middleware for connect.
Pro Has detailed information
Very simple and fast.
Pro Lightweight
Pro Massive ecosystem of middleware
If you have not already checked out the Express.js ecosystem of middleware, you should.
Pro Well organized and thorough documentation
Slim's documentation is well organized and detailed, every concept is thoroughly explained and it is very helpful for both advanced users and beginners.
Pro A good starting point
Slim is minimal and that is a good thing if you want to start from there. It can be easily extended and even supports popular packages that are used in Laravel (like Illuminate\Database (eloquent)) for example.
Pro REST based
REST fans will love the REST based architecture.
Pro Supports tie-ins for Rack-like middleware
Rack is an interface used in Ruby frameworks used to group and order modules, which most of the time are Ruby classes, and specify between them.
Slim uses a simple concept for it's middleware. By wrapping HTTP requests and responses it unifies the middleware into a single method call.
Pro Useful classes
Contains classes for managing requests, responses, cookies, logging, views, HTTP caching, and more.
Pro Flexible
Slim doesn't demand that you stick to a fixed folder structure. As long as you load Slim the right way you can do anything from there the way you like it.
Pro Extremely lightweight
Paired with swoole it's a micro service powerhouse.
Pro Open source
The Slim Framework is open source and is released under the MIT public license
Pro Extremely customizable
You can add any dependency, package or class that you want to use as a contained dependency.
Pro Supports Php 5.3 and PHP 7
Pro Makes it easy to understand the way some abstract functions and classes are built
In Django most things are abstracted, you just call some function or class without knowing how they were built, but with Slim, you end up understanding the way some abstract functions and classes are built.
Pro Hooks for executing code at different points in its life-cycle
Slim supports code hooks for executing functions at different points in time during the application's lifecycle.
Cons
Con No single recommended way of doing something
Express considers itself to be a "minimalistic unopinionated framework", it basically lets the developer determine how their project will be organized. On one hand, this gives anyone terrific power and flexibility to use any library they want for a certain task and to organize their project structure however they want. But on the other hand, there's no single recommended way of organizing things, which can be a trap for beginners and experienced developers alike and result in unmaintainable projects.
Con Very little consistency among different versions
There have been quite some changes that break the compatibility between Slim 2 and Slim 3. Even if you learned how to work with the Slim 2, you will find that Slim 3 requires re-training.
Con Dependency injection is too weak
It is not really dependency injection, but just a configurable container.
Con Needs strong bases to create dependencies
The dependency container schema of Slim is one of the biggest PROS and CONS of the framework. It is true that this schema brings so much flexibility to add anything, but another thing that is true is that you need to have strong bases of patterns, and an extensive knowledge of your libraries to convert it into a Slim dependency.
Con Too minimal
While it's true that Slim is a microframework, it's still too minimal. When used for throwaway projects or simple prototypes, it's perfect. But in the long run, it becomes less and less useful and you end up in implementing a full custom framework in trying to tackle all the missing features.