This project is the full-stack application made using Next.js, allowing users to write and share their blogs. For backend Serverless Functions are used written with Node.js. Given below are some of the key feature of this app.
- Server-side rendering the components.
- Code splitting, pre-rendering the pages.
- Fast content delivery network.
- Allow users to write blog and get a URL to share it with anyone.
- Feature to update or delete the blog.
- User authentication for better security
Parsing the markdown
- Setp 1: Parsing the markdown from frontend using marked, which is low-level compiler for parsing markdown.
- Step 2. Sanitize the generated HTML using Dompurify as
marked
does not output the sanitized html.
Rendering parsed html
- Use
dangerouslySetInnerHTML
to set HTML directly from React, which is an attribute under DOM elements in React.
Before setting up the development environment make sure you have downloaded the npm ~6.14
and Node.js ~14.16
and added them to path variables. Downloading Node.js
-
Clone the repository using command:
git clone https://github.com/lakshya-20/first-draft.git
-
Install NPM packages
npm install
-
Update the
.env.development
file with required environment variables. -
In the root directory run
npm run dev
-
Open http://localhost:3001 to view it in the browser.
- Fork it
- Create your feature branch
(git checkout -b my-new-feature)
- Commit your changes
(git commit -m 'Add some feature')
- In case of multiple commits squash them. You can find guide here: how to squash commits
- Run the tests with
(npm run test)
and make sure all tests are passed. - Push your branch
(git push origin my-new-feature)
- Create a new Pull Request, following the template