The simple framework for building nodejs rest api with expressjs
$ npm i -g foton-cli
$ foton create --project <project-name>
This boilerplate have a AuthServiceProvider for Manage authenticated user easily, like get authenticated user data, Atempt login, Logout authenticated user.
for example i want retrive authenticated user data, i just write code in the controller like this.
// import AuthServiceProvider
const Auth = require("../../Providers/AuthServiceProvider")
const UserController = {
getProfile: async function(req, res) {
// use the AuthServiceProvider
const users = await Auth.user(req) // output should user data
return res.json({
"message" : "OKE!",
"status" : 200,
"data" : users
})
}
}
- Seperate route and handler
- Env configuration
- Database Connection
- ORM integration
- Middleware
- Auth Service Provider
- Auto Migrate Database
- Database seeder
- Unit Testing
- Code generator Like artisan laravel
- Add Socket connection
- BREAD Sample
- End to end encryption connection