- Invade the Code π½
- Posts
- π Day 11 of #100DaysOfCode: Cleaning Code, Deployment, and TDD! π
π Day 11 of #100DaysOfCode: Cleaning Code, Deployment, and TDD! π
Hey Invaders! π½
#100DaysOfCode day 11, today was a productive day! Here's what I worked on:
Project Cleanup and Deployment:
Cleaned up some code my partner added to a project we're freelancing on.
Deployed the project on GoDaddy's cPanel.
The project was created using vanilla Vite for a multipage application.
The process of uploading the
dist
files Vite creates was straightforward, but I encountered an issue with configuring the.htaccess
file to remove/index.html
from the URL.Current
.htaccess
file:<IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^ index.html [L] </IfModule>
Then I Tried this but it didnβt fix the index.html and just ruined my tailwind styling
<IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^(.+[^/])/$ $1 [R=301,L] RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s(.*)/index\.html\sHTTP [NC] RewriteRule ^ %1 [R=301,L] RewriteRule ^$ /index.html [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^ /index.html [L] </IfModule>
If you are a CPanel guru and know how I can rewrite the URLs so they still follow Viteβs multipage routing but can remove the /index.html on every page please let me know!!!!!!
JUnit Course Progress:
Learned about TDD and its benefits.
Created a new project class method and implemented a
UserService
andUserServiceImpl
while writing acreateUser
test.
Here's a snippet of my createUser
test:
@Test
void testCreateUser_whenUserDetailsProvided_ReturnUserObject(){
//Arrange
UserService userService = new UserServiceImpl();
String firstName = "ari";
String lastName = "vanegas";
String email = "[email protected]";
String password = "1234567";
String repeatPassword = "1234567";
//Act
User user = userService.createUser(firstName,lastName,email,password,repeatPassword);
//Assert
assertNotNull(user, "The createUser() should not have returned null");
assertEquals(firstName, user.getFirstName(), "users first name does not match");
}
Feeling accomplished and eager to continue this journey! Follow my GitHub for more updates and code snippets: avrubio/JUnitUdemyCourse.
Keep coding, keep conquering! πͺ
Reply