1.0.4 • Published 7 months ago
mapplejs v1.0.4
MappleJs
A framework to build api faster than and easier to maintain using Fastify.
Getting Started (Using MappleJs CLI)
- Create a new Mapple project:
- npx mapplejs generate app
or
- npx mapplejs g app
- Create service
- npx mapplejs generate service
- Start development server:
- npm run dev
Available Scripts
npm run dev
- Starts development servernpm start
- Runs production server
Manually
- Create src/index.js file
const { serviceInit } = require("mapplejs");
const app = fastify();
class UserService {
path = "users";
constructor(app) {
this.app = app;
}
// GET /users
async find(req, res) {
return [];
}
// GET /users/:id
async get(id, req, res) {
return { id };
}
// POST /users
async create(data, req, res) {
return { data };
}
// PATCH /users/:id
async patch(id, data, req, res) {
return { id, data };
}
// DELETE /users/:id
async delete(id, req, res) {
return { id };
}
}
app.decorate("service", {});
app.register(function (app) {
serviceInit(app, new UserService(app));
});
app.listen({ port: 3000 }).then(() => {
console.log("server is running on http://localhost:3000");
});
Features
- Uses Fastify
- Create routes easily
License
ISC
1.0.4
7 months ago
0.0.22
7 months ago
0.0.21
7 months ago
0.0.20
7 months ago
0.0.19
7 months ago
0.0.18
7 months ago
0.0.17
7 months ago
0.0.16
7 months ago
0.0.15
7 months ago
0.0.14
7 months ago
0.0.13
7 months ago
0.0.12
7 months ago
0.0.11
7 months ago
0.0.9
7 months ago
0.0.8
7 months ago
0.0.7
7 months ago
0.0.6
7 months ago
0.0.5
7 months ago
0.0.4
7 months ago
0.0.3
7 months ago
0.0.2
7 months ago
0.0.1
7 months ago
1.0.3
7 months ago
1.0.2
7 months ago
1.0.1
7 months ago
1.0.0
7 months ago