A data-focused entry in TopGit's GitHub warehouse: t4t5/november-cli, 51 stars, Data, JavaScript. ❄️ Generate a Node.js API for your Ember.js app
Snapshot summary built from the project's own GitHub metadata — there's no written TopGit review yet. The page will update automatically when a full review is published.
WHY NO REVIEW YET
TopGit writes full reviews for the most-starred, most-requested repositories. This page is a snapshot until then — see the READ ME tab for the original README in full.
A model file (app/models/user.js) for the user, which will determine the structure of the database table
Routes in app/router.js for creating, reading, updating and deleting users (based on the conventions of Ember Data). Feel free to remove the actions you don't need.
Controller files, which hook up the routes to database actions:
app/controllers/user/add.js
app/controllers/user/list.js
app/controllers/user/load.js
app/controllers/user/update.js
app/controllers/user/remove.js
With the app and your local database running in the background, visit localhost:9000/users, and you should see:
{
"users": []
}
The table users has automatically been created in your database.
Actions
Actions are for API endpoints which are not specifically tied to any model.
$ november generate action login
This generates:
An action file (app/actions/login.js)
A route in app/router.js (POST by default)
Render()
The render()-method in your controllers is used for rendering both your models and your error messages. It takes a single argument.
Rendering models
If you pass a valid sequelize model to render(), it will generate that model according to the JSON API conventions used by Ember Data.
The most basic usage:
render(<your-sequelize-model>);
...which can also be typed like this:
render({
model: <your-sequelize-model>
});
returns:
{
"user": {
<...>
}
}
If your sequelize model includes associated models, they are sideloaded by default:
... while still showing a more descriptive error to the developer in the console so that you can locate the problem:
You can also render your own exceptions to the user, by throwing a string with the error message or an array where the first element is the error code and the second is the error message:
// app/controllers/user/update.js
req.models.user.find({
where: {
username: req.params.username
}
})
.then(function(user) {
if (user.id !== req.user) {
throw [403, "You are not allowed to edit this user!"]
}
return user.save();
})
.then(function(user) {
// Not gonna happen
})
.catch(function(err) {
render(err);
});
...what the client will see:
{
"error": {
"code": 403,
"message": "You are not allowed to edit this user!"
}
}
Todos
TDD is not really my thing, but it would be nice to get some automatic Mocha tests when you generate new models. :)
Contact
If you have any questions, feel free to ping me on Twitter or just open an issue!
No homepage URL was recorded for t4t5/november-cli in TopGit's last sync. The README tab above frequently contains screenshots and demo links, or check the repository description on GitHub.
How active is development on t4t5/november-cli?
The most recent commit recorded on t4t5/november-cli was 9.8 years ago, based on the GitHub push timestamp. The repository has 10 forks — one of the better signals of community interest.
Is t4t5/november-cli open source?
Yes — t4t5/november-cli ships under the MIT license, which makes its source code freely readable (and, depending on license terms, forkable and reusable). Source: github.com/t4t5/november-cli.
What license does t4t5/november-cli use?
t4t5/november-cli is released under the MIT license. Always verify the LICENSE file directly on GitHub for the authoritative terms — license strings can be edited out of sync with a project's actual stance.
What topics is t4t5/november-cli associated with?
GitHub's repository topics for t4t5/november-cli: "database", "ember", "ember-data", "nodejs", "sequelize". TopGit's editorial category is Data.
Where do I read more about t4t5/november-cli?
This TopGit page is a snapshot — the READ ME tab shows the project's own README content (links stripped, images preserved). The GitHub repository at github.com/t4t5/november-cli is the definitive source.
Read full README in the tab above.
Still deciding about november-cli?
One click hands the question to an AI along with this page — see what it says about november-cli.