This project utilizes the AdminJS library, which is a frontend library for building admin panels in Node.js applications. It provides a user-friendly interface for managing data, including CRUD (Create, Read, Update, Delete) operations.
| Route | HTTP Method | Parameters | Description |
|---|---|---|---|
/auth/register |
POST | - | Register a new user |
/auth/login |
POST | - | Login user |
/categories |
GET | - | Get all categories |
/categories/:id |
GET | :id |
Get a specific category |
/menu/featured |
GET | - | Get featured menu items |
/menu/newest |
GET | - | Get newest menu items |
/menu/:id |
GET | :id |
Get a specific menu item |
/users/current |
GET | - | Get current user information |
/users/current |
PUT | - | Update current user information |
/users/current/password |
PUT | - | Update current user password |
Example of request body for POST /auth/register:
{
"name": "john doe",
"email": "johndoe@email.com",
"password": "password123"
}Example of request body for PUT /users/current:
{
"name": "john doe"
}To clone the repository and view it locally, the user can follow these steps:
git clone https://github.com/fabricio-fn/adminjs-test.gitOr download the project as a zip file by clicking here
Go to the project folder and use the command below to install the dependencies
npm installRename the .env.example file to .env.local and fill it with your values
Create the database (if it does not exist yet):
npx sequelize-cli db:createIf you encounter this error
Sequelize CLI [Node: 20.9.0, CLI: 6.6.2, ORM: 6.35.2]
Loaded configuration file "sequelize.js".
Using environment "development".
ERROR: password authentication failed for user "userTest"you will need to manually create it from the PostgresSQL command line
CREATE USER new_user WITH PASSWORD 'password' CREATEDB;Run migrations to create tables in the database:
npx sequelize-cli db:migrateYou can populate the database with some categories or create them in the admin panel at the /admin route
npx sequelize-cli db:seed:allStart the server locally:
npm run devNow you should be able to test the http routes and access the admin panel at the /admin route.