FnAPI is a project that utilizes GitHub Pages to host and serve a JSON-based API. This API allows you to manage user data and interact with the data through a web interface.
- Dynamic User Management: Create, read, and update user data using GitHub Pages.
- Easy Deployment: Leveraging GitHub Pages for API hosting and data storage.
- Simple Integration: Easily integrate with other services and applications.
- Git: Ensure that Git is installed on your machine.
- GitHub Account: You need a GitHub account to host the repository and use GitHub Pages.
-
Clone the Repository
git clone https://github.com/yourusername/FnAPI.git cd FnAPI
-
Set Up Environment Variables
Create a
.env
file in the root directory of the project with the following content:VITE_FILE_PATH=user.json VITE_REPO_OWNER=yourusername VITE_REPO_NAME=yourrepository VITE_ACCESS_TOKEN=your_github_access_token VITE_BRANCH_NAME=main
-
Configure GitHub Pages
- Go to the GitHub repository page.
- Navigate to Settings > Pages.
- Select the branch (
main
orgh-pages
) and folder (usually/root
). - Save the settings.
-
Run the Application
If you are using a local development environment, start your application. For example, if you're using Vue:
npm install npm run serve
-
Deploy Changes
Push your changes to GitHub:
git add . git commit -m "Initial setup for FnAPI" git push origin main
To create a new user, simply use the web interface provided by the GitHub Pages site. Fill in the user details and click "Create User."
The API file (user.json
) will be updated automatically whenever a new user is created or existing data is modified.
If you encounter a 401 Unauthorized error:
- Check that your GitHub access token is correct and has the necessary permissions.
- Ensure that the
.env
file is correctly configured.
If you encounter a 409 Conflict error:
- Make sure that you have resolved any potential conflicts in the
user.json
file before pushing changes. - Check if there are concurrent modifications and resolve them.
Feel free to contribute to the project by submitting issues or pull requests. For more details, check out the contributing guide.
This project is licensed under the MIT License - see the LICENSE file for details.