https://github.com/lepresk/node-assessment
https://github.com/lepresk/node-assessment
Last synced: 4 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/lepresk/node-assessment
- Owner: lepresk
- Created: 2024-04-23T20:40:36.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-04-23T20:58:15.000Z (about 1 year ago)
- Last Synced: 2025-01-12T10:15:44.722Z (5 months ago)
- Language: JavaScript
- Size: 21.5 KB
- Stars: 0
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Node.js Project with Express.js and SQLite3
This project is a Node.js application using Express.js as a web framework and SQLite3 as a database. The application provides endpoints to manage categories, posts, and tasks.
## Installation
1. Clone this repository:
```
git clone https://github.com/lepresk/node-assessment
```2. Install dependencies:
```
pnpm install
```3. Run the application:
```
pnpm start
```## Available Endpoints
### Categories
- `GET /categories` : Get all categories.
### Posts
- `GET /posts` : Get all posts.
- `GET /posts/:id` : Get a post by ID.
- `POST /posts` : Create a new post.
- `PUT /posts/:id` : Update an existing post.
- `DELETE /posts/:id` : Delete an existing post.### Tasks
- `GET /tasks` : Get all tasks.
- `GET /tasks/:id` : Get a task by ID.
- `POST /tasks` : Create a new task.
- `PUT /tasks/:id` : Update an existing task.
- `DELETE /tasks/:id` : Delete an existing task.## Project Structure
- `db.mjs` : Database connection management.
- `post_repository.mjs` : Functions to interact with post and task data.
- `router.mjs` : API route definitions.
- `index.mjs` : Entry point of the application.## Development
- The database is initialized with tables for categories, posts, and tasks on the first startup of the application.
- API routes are defined in `router.mjs`.
- Functions to interact with the database are located in `post_repository.mjs`.