Security News
JSR Working Group Kicks Off with Ambitious Roadmap and Plans for Open Governance
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
Cli for the Ash API framework
View the API docs at https://ash-framework.github.io/core
npm install --global ash-cli
ash
Make sure you are running the latest version of node js (At least version 7)
Install yarn
npm install --global yarn
You can install the Ash cli either via yarn
or npm
// option 1. via yarn
yarn global add @ash-framework/cli
// option 2. via npm
npm install --global @ash-framework/cli
mkdir my-awesome-project
cd my-awesome-project
ash init
ash generate route posts
Edit your app/routes/posts.js route file to return something from the provided model hook
// app/routes/posts.js
import Ash from 'ash-core'
export default class PostsRoute extends Ash.Route {
model () {
return [
{id: 1, title: 'My post 1', description: 'WoW'},
{id: 2, title: 'My post 2', description: 'WoWsErS'}
]
}
}
ash server
and visit the url: http://location:3010/posts
Create a new postgres database with a table named posts
.
Add 2 text fields title
and description
as well as a sequence id
Edit your apps database configuration in the environment config file
config/environment.js
module.exports = function (environment) {
const ENV = {
host: 'http://localhost',
port: 3010
}
ENV.database = {
connection: {
user: '<username>',
pass: '<password>',
database: '<database to use>'
}
}
return ENV
}
ash generate model post
Edit your app/models/post.js
file to define a models attributes
// app/models/post.js
import Ash from 'ash-core'
export default class PostsRoute extends Ash.Route {
static attributes (attr) {
attr('title', 'string')
attr('description', 'string')
}
}
Edit your app/routes/posts.js
model hook, change it to return post model data
// app/routes/posts.js
import Ash from 'ash-core'
export default class PostsRoute extends Ash.Route {
model () {
return this.store.findAll('post')
}
}
Note: You can also omit the model hook entirely in this case due to naming conventions.
A posts
route will try to load all post
models if no model hook is present.
Refresh: http://location:3010/posts
and you should see your posts models serialized in JSON API format.
Discover the release history by heading on over to the releases page.
These amazing people are maintaining this project:
These amazing people have contributed finances to this project:
Become a sponsor!
These amazing people have contributed code to this project:
Unless stated otherwise all works are:
and licensed under:
FAQs
Cli for the Ash API framework
The npm package ash-cli receives a total of 2 weekly downloads. As such, ash-cli popularity was classified as not popular.
We found that ash-cli demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
Security News
Research
An advanced npm supply chain attack is leveraging Ethereum smart contracts for decentralized, persistent malware control, evading traditional defenses.
Security News
Research
Attackers are impersonating Sindre Sorhus on npm with a fake 'chalk-node' package containing a malicious backdoor to compromise developers' projects.