This is my try.
$y(x)e^x=\int|x|e^xdx$
$=\int_x^0(-t)e^tdt+\int_0^xte^tdt$
$=2+2(x-1)e^x+c$
$y(x)=2e^{-x}+(x-1)2+ce^{-x}$.
with $y(-1)=0$ gives $c=1-\frac{3}{e}$
but later I find which is wrong. where is my mistake?
This is my try.
$y(x)e^x=\int|x|e^xdx$
$=\int_x^0(-t)e^tdt+\int_0^xte^tdt$
$=2+2(x-1)e^x+c$
$y(x)=2e^{-x}+(x-1)2+ce^{-x}$.
with $y(-1)=0$ gives $c=1-\frac{3}{e}$
but later I find which is wrong. where is my mistake?
For $x\ge 0$
$$y' + y = x \implies y=c_1 e^{-x}+x-1$$
For $x < 0$
$$y' + y = -x \implies y=c_2e^{-x}-x+1$$
We know that $y(-1)=0$ which implies that
$$0 = c_2e+2 \implies c_2=-\frac{2}{e} = -2e^{-1}$$
We now know that $|x|=|-x|$ at $x=0$ and so
$$-2e^{-1}+1 = c_1 - 1 \implies c_1 = 2-2e^{-1}
$$
$$\color{red}{y =
\begin{cases}
-2e^{-x-1}-x+1, & \text{if $x$ is negative} \\[2ex]
\;\;\,(2-2e^{-1})e^{-x}+x-1 & \text{if $x$ is non-negative}
\end{cases}}$$
The homogenous equation $y' + y = 0\\ y = C_1 e^-t$
A particular solution
Suppose $y = Ax + B$
$y' = A\\ A + Ax + B = |x|\\ A = sgn x\\ B = -A$
$y = \begin{cases} C_1 e^{-t} + x - 1 & x\ge 0\\C_2 e^{-t} - x + 1 & x< 0 \end{cases}$
$y(-1) = 0$
$C_2 e + 2 = 0\\ C_2 = -2 e^{-1}$
$y(0) = $$-2e^{-1}+1 = C_1 -1\\ C_1 = -2e^{-1} + 2$
$y = \begin{cases} (-2e^{-1} + 2) e^{-t} + x - 1 & x\ge 0\\ -2e^{-t-1} - x + 1 & x< 0 \end{cases}$
$y(1) = (-2e^{-1} + 2) e^{-1} = -2e^{-2} + 2e^{-1}$