
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
GraphQLess ⚛️ 🚀🤘 REST and GraphQL really aren't that different. I'll prove it!</
REST and GraphQL really aren't that different. I'll prove it!
GraphQLess is a thin wrapper around the official express-graphql project.
GraphQLess lets you write a GraphQL server in an Express.js style.
yarn add graphqless
And here is how you write a server... Look familiar?
const { GraphQLess } = require('graphqless');
const app = new GraphQLess();
const db = { users: [{ name: 'Tyler' }] };
app.get('/users', (req, res) => {
const { users } = db;
res.send(users);
});
app.get('/user', (req, res) => {
const user = db.users.find(user => user.name === req.body.name);
res.send(user);
});
app.post('/createUser', (req, res) => {
const userCount = db.users.push({ name: req.body.name });
res.send(userCount);
});
app.listen(3000, () => {
console.log('Visit: http://localhost:3000/playground');
});
I know it looks like Express.js but the code above is a GraphQL server! There is one caveat though...
GraphQL requires us to write a schema that describes the .get and .post functions' inputs and outputs.
Just know that .get === Query && .post === Mutation. Now let's modify the last few lines of the snippet above to include the required schema:
app
.useSchema(
`
type Query {
users: [User]
user(name: String): User
}
type Mutation {
createUser(name: String): Int
}
type User {
name: String
}
`
)
.listen(3000, () => {
console.log('Visit: http://localhost:3000/playground');
});
That's the only catch! You now have a fully functioning and extendable GraphQL server.
You can find more examples in the examples folder.
npx nodemon examples/example.js
mutation createUser {
createUser(name: "Buchea")
}
query getUsers {
users {
name
}
user(name: "Tyler") {
name
}
}
npx nodemon examples/exampleWithAuth.js
# Add this to "HTTP HEADERS" in GraphQL Playground:
# { "Authorization": "Bearer eyJhbGciOiJIUzI1NiJ9.YWJj.4noRC-c0ay0hOeZ5Cgc80MVS0P4p4FrR2lJFzMNSnE4" }
query getMe {
getToken
me {
id
name
}
}
npx nodemon examples/exampleWithRouter/index.js
mutation createUser {
createUser(name: "Buchea")
}
query getUsers {
users {
name
}
user(name: "Tyler") {
name
}
}
npx nodemon examples/exampleWithReactClient/index.js
mutation createUser {
createUser(name: "Buchea") {
name
}
}
query getUsers {
users {
name
}
}
npx nodemon examples/exampleWithSubscription.js
subscription subscribeToCount {
count
}
query getDummyData {
dummy
}
FAQs
GraphQLess ⚛️ 🚀🤘 REST and GraphQL really aren't that different. I'll prove it!</
The npm package graphqless receives a total of 3 weekly downloads. As such, graphqless popularity was classified as not popular.
We found that graphqless demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.